本文整理汇总了C#中TripleStore.AddInferenceEngine方法的典型用法代码示例。如果您正苦于以下问题:C# TripleStore.AddInferenceEngine方法的具体用法?C# TripleStore.AddInferenceEngine怎么用?C# TripleStore.AddInferenceEngine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TripleStore
的用法示例。
在下文中一共展示了TripleStore.AddInferenceEngine方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SparqlViewAndReasonerInteraction
public void SparqlViewAndReasonerInteraction()
{
try
{
TripleStore store = new TripleStore();
SparqlView view = new SparqlView("CONSTRUCT { ?s a ?type } WHERE { ?s a ?type }", store);
view.BaseUri = new Uri("http://example.org/view");
store.Add(view);
Console.WriteLine("SPARQL View Empty");
TestTools.ShowGraph(view);
Console.WriteLine();
//Load a Graph into the Store to cause the SPARQL View to update
Graph g = new Graph();
FileLoader.Load(g, "InferenceTest.ttl");
g.BaseUri = new Uri("http://example.org/data");
store.Add(g);
Thread.Sleep(200);
if (view.Triples.Count == 0) view.UpdateView();
Console.WriteLine("SPARQL View Populated");
TestTools.ShowGraph(view);
Console.WriteLine();
Assert.IsTrue(view.Triples.Count > 0, "View should have updated to contain some Triples");
int lastCount = view.Triples.Count;
//Apply an RDFS reasoner
StaticRdfsReasoner reasoner = new StaticRdfsReasoner();
reasoner.Initialise(g);
store.AddInferenceEngine(reasoner);
Thread.Sleep(200);
if (view.Triples.Count == lastCount) view.UpdateView();
Console.WriteLine("SPARQL View Populated after Reasoner added");
TestTools.ShowGraph(view);
}
catch (RdfQueryException queryEx)
{
TestTools.ReportError("Query Error", queryEx, true);
}
catch (RdfException ex)
{
TestTools.ReportError("Error", ex, true);
}
}