本文整理汇总了C#中VDS.RDF.Graph.ToDataTable方法的典型用法代码示例。如果您正苦于以下问题:C# Graph.ToDataTable方法的具体用法?C# Graph.ToDataTable怎么用?C# Graph.ToDataTable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VDS.RDF.Graph
的用法示例。
在下文中一共展示了Graph.ToDataTable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetInferredPlaces
private List<string> GetInferredPlaces(Graph outputGraph)
{
List<string> inferredResults = new List<string>();
foreach (DataRow row in outputGraph.ToDataTable().Rows)
{
inferredResults.Add(row.ItemArray[0].ToString());
}
return inferredResults;
}
示例2: ExtractResults
private Collection<BaprLocation> ExtractResults(Graph graph, List<string> inferredResults)
{
Collection<BaprLocation> results = new Collection<BaprLocation>();
List<object[]> itemsArray = new List<object[]>();
foreach (DataRow row in graph.ToDataTable().Rows)
{
itemsArray.Add(row.ItemArray);
}
foreach (var group in itemsArray.GroupBy(x => x[0]))
{
if (!inferredResults.Contains(group.Key.ToString()))
continue;
BaprLocation location = new BaprLocation();
location.attributes = new Collection<BaprLocationAttribute>();
foreach (object[] attribute in group)
{
string attrValue = attribute[2].ToString();
if (attribute[1].ToString().Contains("label"))
location.name = GetAttributeName(attrValue);
else if (attribute[1].ToString().Contains("lat"))
location.latitude = GetCoordinate(attrValue);
else if (attribute[1].ToString().Contains("long"))
location.longitude = GetCoordinate(attrValue);
else
{
BaprLocationAttribute attr = new BaprLocationAttribute();
attr.Name = GetLastSubstring(attribute[1].ToString());
attr.Value = SplitValue(attribute[1].ToString(), attribute[2].ToString());
attr.Type = "string";
location.attributes.Add(attr);
}
}
results.Add(location);
}
return results;
}