ArcGIS Pro 3.2 API Reference Guide
ArcGIS.Core.Data.Knowledge Namespace / KnowledgeGraphNamedObjectTypeRole Enumeration
Example Example

In This Topic
    KnowledgeGraphNamedObjectTypeRole Enumeration
    In This Topic
    Represents the role of a named object type. See KnowledgeGraphNamedObjectType.GetRole.
    Syntax
    public enum KnowledgeGraphNamedObjectTypeRole : System.Enum, System.IComparable, System.IConvertible, System.IFormattable  
    Public Enum KnowledgeGraphNamedObjectTypeRole 
       Inherits System.Enum
       Implements System.IComparable, System.IConvertible, System.IFormattable 
    Members
    MemberDescription
    Document Document.
    Provenance Provenance.
    Regular Regular.
    Example
    Get Data Model MetaEntityTypes/Provenance
    //Provenance entity type is stored as a MetaEntityType 
    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.GetMetaEntityTypes();
          //If there is no provenance then MetaEntityTypes will be
          //an empty collection
          foreach (var kvp in dict_types)
          {
            var meta_entity_type = kvp.Value;
            if (meta_entity_type.GetRole() == 
                KnowledgeGraphNamedObjectTypeRole.Provenance)
            {
              //TODO - use the provenance entity type
              var name = meta_entity_type.GetName();
    
            }
          }
          
        }
      }
    });
    
    Get Whether KG Supports Provenance
    internal string GetProvenanceEntityTypeName(KnowledgeGraphDataModel kg_dm)
    {
      var entity_types = kg_dm.GetMetaEntityTypes();
      foreach (var entity_type in entity_types)
      {
        if (entity_type.Value.GetRole() == KnowledgeGraphNamedObjectTypeRole.Provenance)
          return entity_type.Value.GetName();
      }
      return "";
    }
    internal bool KnowledgeGraphSupportsProvenance(KnowledgeGraph kg)
    {
      //if there is a provenance entity type then the KnowledgeGraph
      //supports provenance
      return !string.IsNullOrEmpty(
        GetProvenanceEntityTypeName(kg.GetDataModel()));
    }
    Get KnowledgeGraph Entity 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.GetEntityTypes();
    
          foreach (var kvp in dict_types)
          {
            var entity_type = kvp.Value;
            var role = entity_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 = entity_type.GetName();
            //etc
    
          }
    
        }
      }
    });
    
    Get Whether KG Has a Document Type
    internal string GetDocumentEntityTypeName(KnowledgeGraphDataModel kg_dm)
    {
      var entity_types = kg_dm.GetEntityTypes();
      foreach (var entity_type in entity_types)
      {
        var role = entity_type.Value.GetRole();
        if (role == KnowledgeGraphNamedObjectTypeRole.Document)
          return entity_type.Value.GetName();
      }
      return "";//Unusual - probably Neo4j user-managed
    }
    
    internal bool KnowledgeGraphHasDocumentType(KnowledgeGraph kg)
    {
      //uncommon for there not to be a document type
      return !string.IsNullOrEmpty(
        GetDocumentEntityTypeName(kg.GetDataModel()));
    }
    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
       System.ValueType
          System.Enum
             ArcGIS.Core.Data.Knowledge.KnowledgeGraphNamedObjectTypeRole

    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.2 or higher.
    See Also