ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Data.Knowledge Namespace / KnowledgeGraph Class / GetDefinitions<T> Method
The type of dataset definition.
Example

In This Topic
    GetDefinitions<T> Method (KnowledgeGraph)
    In This Topic
    Gets an IReadOnlyList of specific ArcGIS.Core.Data.Definition instances associated with each dataset of type T in the knowledge graph. This method must be called on the MCT. Use QueuedTask.Run.
    Syntax
    public IReadOnlyList<T> GetDefinitions<T>()
    where T: Definition
    Public Function GetDefinitions(Of T As Definition)() As IReadOnlyList(Of T)

    Type Parameters

    T
    The type of dataset definition.

    Return Value

    A IReadOnlyList of specific ArcGIS.Core.Data.Definition instances corresponding to type T.
    Exceptions
    ExceptionDescription
     
    A geodatabase-related exception has occurred.
    This method or property must be called within the lambda passed to QueuedTask.Run.
    Remarks
    Asking for ArcGIS.Core.Data.TableDefinition will only return definitions for non-spatial tables (not feature classes), but asking for ArcGIS.Core.Data.FeatureClassDefinition will return regular feature classes.
    Example
    Retrieving GDB FeatureClasses and Definitions
    QueuedTask.Run(() =>
    {
      //Create a connection properties
      var kg_props =
          new KnowledgeGraphConnectionProperties(new Uri(url));
      //Connect to the KnowledgeGraph datastore
      //KnowledgeGraph datastores contain tables and feature classes
      using (var kg = new KnowledgeGraph(kg_props))
      {
        //Get the featureclass definitions from the KG datastore
        var fc_defs = kg.GetDefinitions<FeatureClassDefinition>();
        //For each feature class definition, get the corresponding
        //feature class. Note: The name of the feature class will match 
        //the name of its corresponding KnowledgeGraph named object type
        //in the KnowledgeGraph graph data model
        foreach (var fc_def in fc_defs)
        {
          var fc_name = fc_def.GetName();
          using (var fc = kg.OpenDataset<FeatureClass>(fc_name))
          {
            //TODO - use the feature class
          }
        }
      }
    });
    Retrieving GDB Tables and Definitions
    QueuedTask.Run(() =>
    {
      //Create a connection properties
      var kg_props =
          new KnowledgeGraphConnectionProperties(new Uri(url));
      //Connect to the KnowledgeGraph datastore
      //KnowledgeGraph datastores contain tables and feature classes
      using (var kg = new KnowledgeGraph(kg_props))
      {
        //Get the table definitions from the KG datastore
        var tbl_defs = kg.GetDefinitions<TableDefinition>();
        //For each table definition, get the corresponding
        //table. Note: The name of the table will match the name
        //of its corresponding KnowledgeGraph named object type in
        //the KnowledgeGraph graph data model
        foreach (var tbl_def in tbl_defs)
        {
          var tbl_name = tbl_def.GetName();
          using (var fc = kg.OpenDataset<Table>(tbl_name))
          {
            //TODO - use the table
          }
        }
      }
    });
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.2 or higher.
    See Also