Public Function GetUidsForNamedType( _ ByVal namedType As String _ ) As IEnumerable(Of Object)
public IEnumerable<object> GetUidsForNamedType( string namedType )
Parameters
- namedType
Public Function GetUidsForNamedType( _ ByVal namedType As String _ ) As IEnumerable(Of Object)
public IEnumerable<object> GetUidsForNamedType( string namedType )
{
//using ArcGIS.Core.Data.Knowledge.Extensions;
await QueuedTask.Run(() =>
{
///var kgConfig = ...;
//var kgSubgraph = ...;
//var measures = ...;
//using(var kg = ...) {
var results = kg.ComputeCentrality(kgConfig, kgSubgraph, 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
}
}
}
});
}
{
//object uid = "{.... uid value ....}";
//or
//object uid = kgResults.RawUids[i]; e.g. in/from a loop
var named_type = "";
foreach (var nt in kgResults.NamedTypes)
{
var uids = kgResults.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
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)