ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Data.Knowledge Namespace / KnowledgeGraphPropertyInfo Class
Members Example

In This Topic
    KnowledgeGraphPropertyInfo Class
    In This Topic
    Class representing information about the names of the unique identifier properties in a knowledge graph. See KnowledgeGraph.GetPropertyNameInfo.
    Object Model
    KnowledgeGraphPropertyInfo ClassDocumentPropertyInfo ClassProvenancePropertyInfo Class
    Syntax
    Public NotInheritable Class KnowledgeGraphPropertyInfo 
    public sealed class KnowledgeGraphPropertyInfo 
    Example
    Get the KG Provenance using KnowledgeGraphPropertyInfo
    {
      await QueuedTask.Run(() =>
      {
        //Create a connection properties
        var kg_props =
            new KnowledgeGraphConnectionProperties(new Uri(url));
        using (var kg = new KnowledgeGraph(kg_props))
        {
          // use the KnowledgeGraphPropertyInfo
          var propInfo = kg.GetPropertyNameInfo();
          var supportsProvenance = propInfo.SupportsProvenance;
          var provenanceType = propInfo.ProvenanceTypeName;
          var provenanceInfo = propInfo.ProvenancePropertyInfo;
        }
      });
    }
    Get the KG Document info using KnowledgeGraphPropertyInfo
    {
      await QueuedTask.Run(() =>
      {
        //Create a connection properties
        var kg_props =
            new KnowledgeGraphConnectionProperties(new Uri(url));
        using (var kg = new KnowledgeGraph(kg_props))
        {
          // use the KnowledgeGraphPropertyInfo
          var propInfo = kg.GetPropertyNameInfo();
          var supportsDocs = propInfo.SupportsDocuments;
          var documentType = propInfo.DocumentTypeName;
          var hasDocumentType = propInfo.HasDocumentTypeName; // available at Pro 3.6 only
          var documentInfo = propInfo.DocumentPropertyInfo;
        }
      });
    }
    Create a new Relationship from Existing Entities 1
    {
      var create_rel = await QueuedTask.Run(() =>
      {
        //Instantiate an operation for the Create
        var edit_op = new EditOperation()
        {
          Name = "Create a new relationship record",
          SelectNewFeatures = true
        };
    
        //Use datasets or feature layer(s) or standalone table(s)
        //Get a reference to the KnowledgeGraph
        //var kg = ... ; 
    
        //We will use a relate called 'HasEmployee' to relate an Organization w/ a Person
        //Use either tables or map members to get the rows to be related...
        var org_fc = kg.OpenDataset<FeatureClass>("Organization");
        var person_tbl = kg.OpenDataset<Table>("Person");
    
        //Get the relationship dataset
        //We can use either a table or standalone table
        var emp_tbl = kg.OpenDataset<Table>("HasEmployee");
    
        //we need the names of the origin and destination relationship properties
        var kg_prop_info = kg.GetPropertyNameInfo();
    
        //Arbitrarily use the first record from the two entity datasets "to be" related
        //Entities are always related by Global ID. Origin to Destination specifies the
        //direction (of the relate).
        //
        //Populate the attributes for the relationship
        var attribs = new Dictionary<string, object>();
    
        using (var rc = org_fc.Search())
        {
          if (rc.MoveNext())
            //Use the KnowledgeGraphPropertyInfo to avoid hardcoding...
            attribs[kg_prop_info.OriginIDPropertyName] = rc.Current.GetGlobalID();
        }
        using (var rc = person_tbl.Search())
        {
          if (rc.MoveNext())
            //Use the KnowledgeGraphPropertyInfo to avoid hardcoding...
            attribs[kg_prop_info.DestinationIDPropertyName] = rc.Current.GetGlobalID();
        }
    
        //Add any extra attribute information for the relation as needed
        attribs["StartDate"] = new DateTimeOffset(DateTime.Now);
    
        //Add a create for the relationship to the operation
        edit_op.Create(emp_tbl, attribs);
    
        //Do the create
        return edit_op.Execute();
      });
    }
    Create a Provenance Record 2
    {
      await QueuedTask.Run(() =>
      {
        // check if provenance supported
        var propInfo = kg.GetPropertyNameInfo();
        if (!propInfo.SupportsProvenance)
          return;
    
        //Instantiate an operation for the Create
        var edit_op = new EditOperation()
        {
          Name = "Create a new provenance record",
          SelectNewFeatures = true
        };
    
        var provName = propInfo.ProvenanceTypeName;
    
        //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
        }
    
        var originHandle = new RowHandle(person_tbl, instance_id);
        var pd = new KnowledgeGraphProvenanceDescription(
          originHandle, "name", KnowledgeGraphSourceType.Document,
          "Annual Review 2024", "HR records", "Rock star");
    
        //Create the provenance row
        edit_op.Create(pd);
        if (edit_op.Execute())
        {
          //TODO: Operation succeeded
        }
    
      });
    }
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.Data.Knowledge.KnowledgeGraphPropertyInfo

    Requirements

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

    ArcGIS Pro version: 3.4 or higher.
    See Also