ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Data.Knowledge Namespace / ProvenancePropertyInfo Class / ProvenanceInstanceIDPropertyName Property
Example

In This Topic
    ProvenanceInstanceIDPropertyName Property
    In This Topic
    Gets the name of the graph property representing the Provenance ID for named object types in a KnowledgeGraph.
    Syntax
    Public ReadOnly Property ProvenanceInstanceIDPropertyName As String
    public string ProvenanceInstanceIDPropertyName {get;}
    Example
    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 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.4 or higher.
    See Also