ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.KnowledgeGraph Namespace / KnowledgeGraphInvestigation Class / GetQueryDefinition Method
The name of the query definition to retrieve. This corresponds to ArcGIS.Core.CIM.CIMKnowledgeGraphQueryDefinition.Name.
Example

In This Topic
    GetQueryDefinition Method
    In This Topic
    Gets the ArcGIS.Core.CIM.CIMKnowledgeGraphQueryDefinition with the specified name. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax

    Parameters

    queryDefinitionName
    The name of the query definition to retrieve. This corresponds to ArcGIS.Core.CIM.CIMKnowledgeGraphQueryDefinition.Name.

    Return Value

    A ArcGIS.Core.CIM.CIMKnowledgeGraphQueryDefinition. If no query definition matching the name is found, null is returned. Note that this method is case sensitive.
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Example
    Retrieve Investigation Query Definitions
    {
      // access the currently active knowledge graph investigation view
      KnowledgeGraphInvestigationView activeView = KnowledgeGraphInvestigationView.Active;
      KnowledgeGraphInvestigation investigation = activeView?.Investigation;
      if (investigation != null)
      {
        await QueuedTask.Run(() =>
        {
          // get all the query defintiions
          var queries = investigation.GetAllQueryDefinitions();
    
          // get a specific query definition
          var myQuery = investigation.GetQueryDefinition("Query1");
        });
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.7 or higher.
    See Also