public IReadOnlyDictionary<string,KnowledgeGraphRelationshipType> GetRelationshipTypes()
Public Function GetRelationshipTypes() As IReadOnlyDictionary(Of String,KnowledgeGraphRelationshipType)
public IReadOnlyDictionary<string,KnowledgeGraphRelationshipType> GetRelationshipTypes()
Public Function GetRelationshipTypes() As IReadOnlyDictionary(Of String,KnowledgeGraphRelationshipType)
Exception | Description |
---|---|
ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
QueuedTask.Run(() => { //Create a connection properties var kg_props = new KnowledgeGraphConnectionProperties(new Uri(url)); using (var kg = new KnowledgeGraph(kg_props)) { //Get the KnowledgeGraph Data Model using (var kg_dm = kg.GetDataModel()) { var dict_types = kg_dm.GetRelationshipTypes(); foreach (var kvp in dict_types) { var rel_type = kvp.Value; var role = rel_type.GetRole(); //note "name" will be the same name as the corresponding //feature class or table in the KG's relational gdb model var name = rel_type.GetName(); //etc. //Get relationship end points var end_points = rel_type.GetEndPoints(); foreach (var end_point in end_points) { System.Diagnostics.Debug.WriteLine( $"Origin: '{end_point.GetOriginEntityTypeName()}', " + $"Destination: '{end_point.GetDestinationEntityTypeName()}'"); } } } } });
QueuedTask.Run(() => { //Create a connection properties var kg_props = new KnowledgeGraphConnectionProperties(new Uri(url)); using (var kg = new KnowledgeGraph(kg_props)) { //Get the KnowledgeGraph Data Model using (var kg_datamodel = kg.GetDataModel()) { var entities = kg_datamodel.GetEntityTypes(); var relationships = kg_datamodel.GetRelationshipTypes(); var provenance = kg_datamodel.GetMetaEntityTypes(); var all_graph_types = new List<KnowledgeGraphNamedObjectType>(); all_graph_types.AddRange(entities.Values); all_graph_types.AddRange(relationships.Values); all_graph_types.AddRange(provenance.Values); System.Diagnostics.Debug.WriteLine("\r\nGraph Types"); int c = 0; foreach (var graph_type in all_graph_types) { var type_name = graph_type.GetName(); var role = graph_type.GetRole().ToString(); //equivalent to: //var fields = featClassDef.GetFields().Select(f => f.Name).ToList(); //var field_names = string.Join(",", fields); var props = graph_type.GetProperties().Select(p => p.Name).ToList(); var prop_names = string.Join(",", props); System.Diagnostics.Debug.WriteLine($"[{c++}]: " + $"{type_name}, {role}, {prop_names}"); } } } });
Target Platforms: Windows 11, Windows 10