public KnowledgeGraph GetDatastore()
Public Function GetDatastore() As KnowledgeGraph
Return Value
The knowledge graph datastore associated with the layer. Returns null if the KnowledgeGraph layer is empty.
public KnowledgeGraph GetDatastore()
Public Function GetDatastore() As KnowledgeGraph
Exception | Description |
---|---|
ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
var kgLayer = MapView.Active.Map.GetLayersAsFlattenedList() .OfType<KnowledgeGraphLayer>().FirstOrDefault(); QueuedTask.Run(() => { // use the layer directly var datastore = kgLayer.GetDatastore(); // or you can use any of the sub items since //KnowledgeGraphLayer is a composite layer - get the first // child feature layer or standalone table var featlayer = kgLayer?.GetLayersAsFlattenedList()? .OfType<FeatureLayer>()?.FirstOrDefault(); KnowledgeGraph kg = null; if (featlayer != null) { using (var fc = featlayer.GetFeatureClass()) kg = fc.GetDatastore() as KnowledgeGraph; //TODO use KnowledgeGraph } else { //try standalone table var stbl = kgLayer?.GetStandaloneTablesAsFlattenedList()? .FirstOrDefault(); if (stbl != null) { using (var tbl = stbl.GetTable()) kg = tbl.GetDatastore() as KnowledgeGraph; //TODO use KnowledgeGraph } } });
Target Platforms: Windows 11, Windows 10