public Dictionary<string,List<long>> ToOIDDictionary()
Public Function ToOIDDictionary() As Dictionary(Of String,List(Of Long))
Return Value
Dictionary of named object types and their corresponding objectIDs.
public Dictionary<string,List<long>> ToOIDDictionary()
Public Function ToOIDDictionary() As Dictionary(Of String,List(Of Long))
var kg_layer = MapView.Active.Map.GetLayersAsFlattenedList() .OfType<KnowledgeGraphLayer>().FirstOrDefault(); if (kg_layer == null) return; QueuedTask.Run(() => { //Get the existing kg layer id set and convert to a dictionary var layer_id_set = kg_layer.GetIDSet(); var dict = layer_id_set.ToOIDDictionary();//Empty list means all records //Create an id set from a dictionary var dict2 = new Dictionary<string, List<long>>(); dict2.Add("Enity_Or_Relate_Type_Name1", null);//Null means all records dict2.Add("Enity_Or_Relate_Type_Name2", new List<long>());//Empty list means all records dict2.Add("Enity_Or_Relate_Type_Name3", new List<long>() { 3, 5, 9, 101, 34 });//Explicit list of ids //dict2.Add("Enity_Or_Relate_Type_Name4", // new List<long>() { etc, etc }); //Create the id set var idset = KnowledgeGraphLayerIDSet.FromDictionary(kg, dict2); //Can be used to create a layer, link chart, append to link chart, etc... });
QueuedTask.Run(() =>
{
  var idSet = kgLayer.GetIDSet();
  // is the set empty?
  var isEmpty = idSet.IsEmpty;
  // get the count of named object types
  var countNamedObjects = idSet.NamedObjectTypeCount;
  // does it contain the entity "Species";
  var contains = idSet.Contains("Species");
  // get the idSet as a dictionary of namedObjectType and oids
  var oidDict = idSet.ToOIDDictionary();
  var speciesOIDs = oidDict["Species"];
  // alternatively get the idSet as a dictionary of 
  // namedObjectTypes and uuids
  var uuidDict = idSet.ToUIDDictionary();
  var speciesUuids = uuidDict["Species"];
});
	Target Platforms: Windows 11, Windows 10