ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.KnowledgeGraph Namespace / KnowledgeGraphInvestigation Class / UpdateQueryDefinition Method / UpdateQueryDefinition(CIMKnowledgeGraphQueryDefinition) Method
The ArcGIS.Core.CIM.CIMKnowledgeGraphQueryDefinition to update.
Example

In This Topic
    UpdateQueryDefinition(CIMKnowledgeGraphQueryDefinition) Method
    In This Topic
    Updates the specified ArcGIS.Core.CIM.CIMKnowledgeGraphQueryDefinition. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Overloads Sub UpdateQueryDefinition( _
       ByVal queryDefinition As CIMKnowledgeGraphQueryDefinition _
    ) 
    public void UpdateQueryDefinition( 
       CIMKnowledgeGraphQueryDefinition queryDefinition
    )

    Parameters

    queryDefinition
    The ArcGIS.Core.CIM.CIMKnowledgeGraphQueryDefinition to update.
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    queryDefinition is null or empty.
    The queryDefinition does not exist in the investigation.
    Remarks
    No update is performed if the specified ArcGIS.Core.CIM.CIMKnowledgeGraphQueryDefinition cannot be found.Use this UpdateQueryDefinition(CIMKnowledgeGraphQueryDefinition) method to change any of the properties of the ArcGIS.Core.CIM.CIMKnowledgeGraphQueryDefinition with the exception of ArcGIS.Core.CIM.CIMKnowledgeGraphQueryDefinition.Name. Use RenameQueryDefinition to alter the name of a Knowledge Graph query definition.
    Example
    Update Query Definition
    {
      // access the currently active knowledge graph investigation view
      KnowledgeGraphInvestigationView activeView = KnowledgeGraphInvestigationView.Active;
      KnowledgeGraphInvestigation investigation = activeView?.Investigation;
      if (investigation != null)
      {
        await QueuedTask.Run(() =>
        {
          // return the first 20 entities
          var newOpenCypherQuery = "MATCH (n) RETURN n LIMIT 20\"";
    
          // update the open cypher query for a query definition
          investigation.UpdateQueryDefinition("Query1", newOpenCypherQuery);
    
    
          // or update other properties
          var myQuery = investigation.GetQueryDefinition("Query1");
          if (myQuery != null)
          {
            myQuery.ProvenanceBehavior = ProvenanceBehavior.Exclude;
            myQuery.OpenCypherQuery = "MATCH (n) RETURN n LIMIT 30\"";
    
            investigation.UpdateQueryDefinition(myQuery);
          }
        });
      }
    }
    Requirements

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

    ArcGIS Pro version: 3.7 or higher.
    See Also