ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.CIM Namespace / CIMKnowledgeGraphQueryDefinition Class / ProvenanceBehavior Property
Example

In This Topic
    ProvenanceBehavior Property (CIMKnowledgeGraphQueryDefinition)
    In This Topic
    Gets or sets the query behavior for Provenance.
    Syntax
    Public Property ProvenanceBehavior As ProvenanceBehavior
    public ProvenanceBehavior ProvenanceBehavior {get; set;}
    Example
    Add Query Definition
    {
      var newQueryDefinition = new CIMKnowledgeGraphQueryDefinition();
      newQueryDefinition.Name = "Query1";
      newQueryDefinition.ProvenanceBehavior = ProvenanceBehavior.Include;
      newQueryDefinition.OpenCypherQuery = "MATCH (n) RETURN n LIMIT 10\"";     // return the first 10 entities
    
      // access the currently active knowledge graph investigation view
      KnowledgeGraphInvestigationView activeView = KnowledgeGraphInvestigationView.Active;
      KnowledgeGraphInvestigation investigation = activeView?.Investigation;
      if (investigation != null)
      {
        await QueuedTask.Run(() =>
        {
          // add the new query defintiion
          investigation.AddQueryDefinition(newQueryDefinition);
        });
      }
    }
    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.3 or higher.
    See Also