ArcGIS Pro 3.5 API Reference Guide
ArcGIS.Desktop.KnowledgeGraph Namespace / KnowledgeGraphInvestigationView Class / Active Property
Example

In This Topic
    Active Property (KnowledgeGraphInvestigationView)
    In This Topic
    Gets the active Knowledge Graph investigation view.
    Syntax
    public static KnowledgeGraphInvestigationView Active {get;}
    Public Shared ReadOnly Property Active As KnowledgeGraphInvestigationView
    Remarks
    Returns null if there is no active investigation view.
    Example
    Get the active KnowledgeGraphInvestigationView, KnowledgeGraphInvestigation
    // access the currently active knowledge graph investigation view
    KnowledgeGraphInvestigationView activeView = KnowledgeGraphInvestigationView.Active;
    KnowledgeGraphInvestigation investigation = activeView?.Investigation;
    if (investigation != null)
    {
      // perform some action
    }
    Select entity, relationship types in an investigation view
    // get the active investigation view
    var iv = KnowledgeGraphInvestigationView.Active;
    
    // clear any TOC selection
    iv.ClearTOCSelection();
    
    // select entities
    List<string> entities = new List<string>();
    entities.Add("Person");
    entities.Add("Org");
    iv.SelectEntities(entities);
    
    // or select relationships
    List<string> relationships = new List<string>();
    relationships.Add("HasEmployee");
    iv.SelectRelationships(relationships);
    
    // or select a combination
    List<string> namedObjectTypes =  new List<string>();
    namedObjectTypes.Add("Person");
    namedObjectTypes.Add("Org");
    namedObjectTypes.Add("HasEmployee");
    iv.SelectNamedObjectTypes(namedObjectTypes);
    Select records in an investigation view
    // get the active investigation view 
    var iv = KnowledgeGraphInvestigationView.Active;
    var serviceUri = iv.Investigation.ServiceUri;
    
    // build a dictionary of records
    var dict = new Dictionary<string, List<long>>();
    //Each entry consists of the type name and corresponding lists of ids
    dict.Add(first_entity, new List<long>() { 1, 5, 18, 36, 78 });
    
    //Create the id set...
    var idSet = KnowledgeGraphLayerIDSet.FromDictionary(new Uri(serviceUri), dict);
    
    // select the records on the investigation view
    iv.SetSelectedRecords(idSet, SelectionCombinationMethod.New);
    Get Selected records and open in a new link chart
    // get the active investigation view
    var iv = KnowledgeGraphInvestigationView.Active;
    
    QueuedTask.Run(() =>
    {
      // get the investigation
      var inv = iv.Investigation;
    
      // get the set of selected records
      var idSet = iv.GetSelectedRecords();
    
      // view these records in a link chart
      var map = MapFactory.Instance.CreateLinkChart("myLinkChart", new Uri(inv.ServiceUri), idSet);
      ProApp.Panes.CreateMapPaneAsync(map);
    });
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.5 or higher.
    See Also