ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Data.Knowledge Namespace / KnowledgeGraphRelationshipType Class
Members Example

In This Topic
    KnowledgeGraphRelationshipType Class
    In This Topic
    Represents a relationship type in the knowledge graph.
    Syntax
    public sealed class KnowledgeGraphRelationshipType : KnowledgeGraphNamedObjectType, System.IDisposable  
    Public NotInheritable Class KnowledgeGraphRelationshipType 
       Inherits KnowledgeGraphNamedObjectType
       Implements System.IDisposable 
    Example
    Get KnowledgeGraph Relationship Types
    QueuedTask.Run(() =>
    {
      //Create a connection properties
      var kg_props =
          new KnowledgeGraphConnectionProperties(new Uri(url));
      using (var kg = new KnowledgeGraph(kg_props))
      {
        //Get the KnowledgeGraph Data Model
        using (var kg_dm = kg.GetDataModel())
        {
          var dict_types = kg_dm.GetRelationshipTypes();
    
          foreach (var kvp in dict_types)
          {
            var rel_type = kvp.Value;
            var role = rel_type.GetRole();
            //note "name" will be the same name as the corresponding
            //feature class or table in the KG's relational gdb model
            var name = rel_type.GetName();
            //etc.
            //Get relationship end points
            var end_points = rel_type.GetEndPoints();
            foreach (var end_point in end_points)
            {
              System.Diagnostics.Debug.WriteLine(
                $"Origin: '{end_point.GetOriginEntityTypeName()}', " +
                $"Destination: '{end_point.GetDestinationEntityTypeName()}'");
            }
          }
    
        }
      }
    });
    
    Inheritance Hierarchy

    System.Object
       ArcGIS.Core.CoreObjectsBase
          ArcGIS.Core.Data.Knowledge.KnowledgeGraphNamedObjectType
             ArcGIS.Core.Data.Knowledge.KnowledgeGraphRelationshipType

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.2 or higher.
    See Also