ArcGIS Pro 3.6 API Reference Guide
ArcGIS.Core.Data.Knowledge.Analytics Namespace / PathsEntitiesAndRelationships Class / RelationshipsUIDs Property
Example

In This Topic
    RelationshipsUIDs Property
    In This Topic
    Gets the UIDs of relationships used in paths.
    Syntax
    public object[] RelationshipsUIDs {get;}
    Public ReadOnly Property RelationshipsUIDs As Object()
    Example
    List out FFP Results Relationships
    //using ArcGIS.Core.Data.Knowledge.Extensions;
    
    await QueuedTask.Run(async () =>
    {
        var ffp_config = new CIMFilteredFindPathsConfiguration();
        ffp_config.Name = "List out FFP Results Relationships";
        //set up config
        //...
    
        var results = kg.RunFilteredFindPaths(ffp_config);
    
        if (results.CountPaths == 0)
        {
            System.Diagnostics.Debug.WriteLine("FFP returned no paths");
            return;
        }
    
        //print out paths by increasing length, min cost, max cost
        var path_by_len_indices = (IEnumerable<long>)results.PathIndicesOrderedByIncreasingPathLength
                                                                .Select(idx => idx.index);
        var path_by_min_cost = (IEnumerable<long>)results.PathIndicesOrderedByIncreasingMinPathCost
                                                                .Select(idx => idx.index);
        var path_by_max_cost = (IEnumerable<long>)results.PathIndicesOrderedByIncreasingMaxPathCost
                                                                .Select(idx => idx.index);
    
        var x = 0;
        StringBuilder sb = new StringBuilder();
    
        foreach (var path_indeces in new List<IEnumerable<long>> {
            path_by_len_indices,
            path_by_min_cost,
            path_by_max_cost})
        {
            if (x == 0)
                sb.AppendLine($"Relationships by length: {path_by_len_indices.Count()}");
            else if (x == 1)
                sb.AppendLine($"Relationships by min cost: {path_by_min_cost.Count()}");
            else if (x == 2)
                sb.AppendLine($"Relationships by max cost: {path_by_max_cost.Count()}");
            x++;
            foreach (var path_idx in path_indeces)
            {
                var path = (ResultPath)results.MaterializePath(path_idx);
                sb.AppendLine(
                    $"Path[{path_idx}] length: {path.Length}, min: {path.MinCost} max: {path.MaxCost}");
    
                var sorted_set = new SortedSet<ulong>();
                sorted_set.Add((ulong)path_idx);
                var per = results.ExtractPathsEntitiesAndRelationships(sorted_set);
    
                var idx = 0;
                foreach (var rel_uid in per.RelationshipsUIDs)
                {
                    sb.Append($" RelationshipsUIDs[{idx}]: ");
    
                    var uid = FormatID(rel_uid.ToString());
                    var rel_info =
                        $"{per.RelationshipTypeNames[per.RelationshipTypes[idx]]}:{uid}";
                    sb.Append($"{rel_info}\r\n");
                    //From entity:
                    var entity_idx = per.RelationshipsFrom[idx];
                    var origin_uid = FormatID(per.EntitiesUIDs[entity_idx].ToString());
                    var origin = $"{per.EntityTypeNames[per.EntityTypes[entity_idx]]}:{origin_uid}";
                    sb.Append($"   RelationshipsFrom: {origin}\r\n");
                    //To entity
                    entity_idx = per.RelationshipsTo[idx];
                    var dest_uid = FormatID(per.EntitiesUIDs[entity_idx].ToString());
                    var dest = $"{per.EntityTypeNames[per.EntityTypes[entity_idx]]}:{dest_uid}";
                    sb.Append($"   RelationshipsTo: {dest}\r\n");
                    idx++;
                }
    
                var rel_str = sb.ToString();
                System.Diagnostics.Debug.WriteLine(rel_str);
    sb.Clear();
            }
        }
    
    });
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3.6 or higher.
    See Also