ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data.Knowledge Namespace / KnowledgeGraphPropertyInfo Class / ProvenancePropertyInfo Property
Example

In This Topic
    ProvenancePropertyInfo Property
    In This Topic
    Gets the ProvenancePropertyInfo if provenance is supported. If provenance is not supported then this will be null. SEe SupportsProvenance.
    Syntax
    public ProvenancePropertyInfo ProvenancePropertyInfo {get;}
    Public ReadOnly Property ProvenancePropertyInfo As ProvenancePropertyInfo
    Example
    Get Whether KG Supports Provenance using KnowledgeGraphPropertyInfo
    internal void KnowledgeGraphProvenance(KnowledgeGraph kg)
    {
      // use the KnowledgeGraphPropertyInfo
      var propInfo = kg.GetPropertyNameInfo();
      var supportsProvenance = propInfo.SupportsProvenance;
      var provenanceType = propInfo.ProvenanceTypeName;
      var provenanceInfo = propInfo.ProvenancePropertyInfo;
    }
    
    Create a Provenance Record
    await QueuedTask.Run(() =>
    {
    
      //Instantiate an operation for the Create
      var edit_op = new EditOperation()
      {
        Name = "Create a new provenance record",
        SelectNewFeatures = true
      };
    
      //lets get the provenance table (provenance is not added to the
      //map TOC)
      var provenance_tbl = kg.OpenDataset<Table>("Provenance");
      if (provenance_tbl == null)
        return;
      //we will add a row to the provenance for person entity
      var person_tbl = kg.OpenDataset<Table>("Person");
    
      //Arbitrarily retrieve the first "person" row
      var instance_id = Guid.Empty;
      using (var rc = person_tbl.Search())
      {
        if (!rc.MoveNext())
          return;
        instance_id = rc.Current.GetGlobalID();//Get the global id
      }
    
      //Define the provenance attributes - we need the names
      //of the provenance properties from the KG ProvenancePropertyInfo
      var kg_prop_info = kg.GetPropertyNameInfo();
      var attribs = new Dictionary<string, object>();
      var ppi = kg_prop_info.ProvenancePropertyInfo;
    
      attribs[ppi.ProvenanceTypeNamePropertyName] =
          person_tbl.GetDefinition().GetName();//entity type name
      attribs[ppi.ProvenanceFieldNamePropertyName] = "name";//Must be a property/field on the entity
      attribs[ppi.ProvenanceSourceNamePropertyName] = "Annual Review 2024";//can be anything - can be null
      //note: Source type is controlled by the CodedValueDomain "esri__provenanceSourceType"
      attribs[ppi.ProvenanceSourceTypePropertyName] = "Document";//one of ["Document", "String", "URL"].
      attribs[ppi.ProvenanceSourcePropertyName] = "HR records";//can be anything, not null
      attribs[ppi.ProvenanceCommentPropertyName] = "Rock star";//can be anything - can be null
    
      //Add in the id of the provenance owner - our "person" in this case
      attribs[ppi.ProvenanceInstanceIDPropertyName] = instance_id;
    
      //Specify any additional custom attributes added to the provenance
      //schema by the user as needed....
      //attribs["custom_attrib"] = "Foo";
      //attribs["custom_attrib2"] = "Bar";
    
      //Create the provenance row
      edit_op.Create(provenance_tbl, attribs);
      if (edit_op.Execute())
      {
        //TODO: Operation succeeded
      }
    
    });
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.4 or higher.
    See Also