ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Desktop.KnowledgeGraph Namespace / KnowledgeGraphInvestigation Class / UpdateQueryDefinition Method / UpdateQueryDefinition(String,String) Method
The name of the ArcGIS.Core.CIM.CIMKnowledgeGraphQueryDefinition to update. This corresponds to ArcGIS.Core.CIM.CIMKnowledgeGraphQueryDefinition.Name.
The new openCypher queryText for the ArcGIS.Core.CIM.CIMKnowledgeGraphQueryDefinition .
Example

In This Topic
    UpdateQueryDefinition(String,String) Method
    In This Topic
    Updates the specified ArcGIS.Core.CIM.CIMKnowledgeGraphQueryDefinition with the new openCypher text. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    Public Overloads Sub UpdateQueryDefinition( _
       ByVal queryDefinitionName As String, _
       ByVal newOpenCypherText As String _
    ) 
    public void UpdateQueryDefinition( 
       string queryDefinitionName,
       string newOpenCypherText
    )

    Parameters

    queryDefinitionName
    The name of the ArcGIS.Core.CIM.CIMKnowledgeGraphQueryDefinition to update. This corresponds to ArcGIS.Core.CIM.CIMKnowledgeGraphQueryDefinition.Name.
    newOpenCypherText
    The new openCypher queryText for the ArcGIS.Core.CIM.CIMKnowledgeGraphQueryDefinition .
    Exceptions
    ExceptionDescription
    This method or property must be called within the lambda passed to QueuedTask.Run.
    queryDefinitionName is null or empty.
    The queryDefinitionName does not exist in the investigation.
    Remarks
    This method is case sensitive.
    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