

Public Class CIMKnowledgeGraphQueryDefinition Inherits CIMObject Implements System.ComponentModel.INotifyPropertyChanged, System.Xml.Serialization.IXmlSerializable
public class CIMKnowledgeGraphQueryDefinition : CIMObject, System.ComponentModel.INotifyPropertyChanged, System.Xml.Serialization.IXmlSerializable
{
// access the currently active knowledge graph investigation view
KnowledgeGraphInvestigationView activeView = KnowledgeGraphInvestigationView.Active;
KnowledgeGraphInvestigation investigation = activeView?.Investigation;
if (investigation != null)
{
await QueuedTask.Run(() =>
{
// get all the query defintiions
var queries = investigation.GetAllQueryDefinitions();
// get a specific query definition
var myQuery = investigation.GetQueryDefinition("Query1");
});
}
}
{
var newQueryDefinition = new CIMKnowledgeGraphQueryDefinition();
newQueryDefinition.Name = "Query1";
newQueryDefinition.ProvenanceBehavior = ProvenanceBehavior.Include;
newQueryDefinition.OpenCypherQuery = "MATCH (n) RETURN n LIMIT 10\""; // return the first 10 entities
// access the currently active knowledge graph investigation view
KnowledgeGraphInvestigationView activeView = KnowledgeGraphInvestigationView.Active;
KnowledgeGraphInvestigation investigation = activeView?.Investigation;
if (investigation != null)
{
await QueuedTask.Run(() =>
{
// add the new query defintiion
investigation.AddQueryDefinition(newQueryDefinition);
});
}
}
{
// access the currently active knowledge graph investigation view
KnowledgeGraphInvestigationView activeView = KnowledgeGraphInvestigationView.Active;
KnowledgeGraphInvestigation investigation = activeView?.Investigation;
if (investigation != null)
{
await QueuedTask.Run(() =>
{
// return the first 20 entities
var newOpenCypherQuery = "MATCH (n) RETURN n LIMIT 20\"";
// update the open cypher query for a query definition
investigation.UpdateQueryDefinition("Query1", newOpenCypherQuery);
// or update other properties
var myQuery = investigation.GetQueryDefinition("Query1");
if (myQuery != null)
{
myQuery.ProvenanceBehavior = ProvenanceBehavior.Exclude;
myQuery.OpenCypherQuery = "MATCH (n) RETURN n LIMIT 30\"";
investigation.UpdateQueryDefinition(myQuery);
}
});
}
}
{
// access the currently active knowledge graph investigation view
KnowledgeGraphInvestigationView activeView = KnowledgeGraphInvestigationView.Active;
KnowledgeGraphInvestigation investigation = activeView?.Investigation;
if (investigation != null)
{
await QueuedTask.Run(() =>
{
// rename the query definition
investigation.RenameQueryDefinition("Query1", "EntityQuery");
});
}
}
{
// access the currently active knowledge graph investigation view
KnowledgeGraphInvestigationView activeView = KnowledgeGraphInvestigationView.Active;
KnowledgeGraphInvestigation investigation = activeView?.Investigation;
if (investigation != null)
{
await QueuedTask.Run(() =>
{
// delete the query definition
investigation.DeleteQueryDefinition("Query1");
});
}
}
System.Object
ArcGIS.Core.CIM.CIMObject
ArcGIS.Core.CIM.CIMKnowledgeGraphQueryDefinition
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)