ArcGIS Pro 3.7 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 Shared ReadOnly Property Active As KnowledgeGraphInvestigationView
    public static KnowledgeGraphInvestigationView Active {get;}
    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
      string some_entity = "Entity_Type_Name";
      var dict = new Dictionary<string, List<long>>();
      //Each entry consists of the type name and corresponding lists of ids
      dict.Add(some_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);
    }
    Clear selected records in an investigation view
    {
      // get the active investigation view 
      var iv = KnowledgeGraphInvestigationView.Active;
    
      // clear the selected records
      iv.ClearSelectedRecords();
    }
    Get Selected records and open in a new link chart
    {
      // get the active investigation view
      var iv = KnowledgeGraphInvestigationView.Active;
    
      await 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 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.5 or higher.
    See Also