ArcGIS Pro 3.6 API Reference Guide
ArcGIS.Core.Data.Knowledge.Analytics Namespace / KnowledgeGraphCentralityResults Class / GetUidsForNamedType Method
Example

In This Topic
    GetUidsForNamedType Method
    In This Topic
    Gets the set of Uids for all entities in the centrality analysis for the given named type.
    Syntax
    public IEnumerable<object> GetUidsForNamedType( 
       string namedType
    )
    Public Function GetUidsForNamedType( _
       ByVal namedType As String _
    ) As IEnumerable(Of Object)

    Parameters

    namedType
    Remarks
    Refer to NamedTypes
    Example
    Output Centrality Results
    //using ArcGIS.Core.Data.Knowledge.Extensions;
    
    await QueuedTask.Run(() =>
    {
      ///var config = ...;
      //var subGraph = ...;
      //var measures = ...;
    
      var results = kg.ComputeCentrality(config, subGraph, measures);
      //loop through each (entity) named type (relates are never included in results)
      foreach (var named_type in results.NamedTypes)
      {
        //Get the entity uids for each named type
        foreach (var uid in results.GetUidsForNamedType(named_type))
        {
          //Get the scores for each uid via the [] indexer on "Scores"
          var scores = results.Scores[uid];
          //There is one score per measure in the input measures array
          //Note: results.Scores.Measures is also provided for convenience...
          //for (int m = 0; m < results.Scores.Measures.Length; m++)
          for (int m = 0; m < measures.Length; m++)
          {
            var score = scores[m];//score for the given measure
                                    //TODO - use measure score
    
          }
        }
      }
    });
    Get The NamedType for a Given UID in Result Scores
    //object uid = "{.... uid value ....}";
    //or
    //object uid = results.RawUids[i]; e.g. in/from a loop
    var named_type = "";
    foreach (var nt in results.NamedTypes)
    {
      var uids = results.GetUidsForNamedType(nt);
      if (uids.Contains(uid))
      {
        named_type = nt;//found it
        break;
      }
    }
    if (string.IsNullOrEmpty(named_type))
    {
      //uid not found in any named type
      //TODO - handle this case
    }
          //TODO - use the named type for the uid
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.6 or higher.
    See Also