本文整理汇总了C#中Store.AddReasoner方法的典型用法代码示例。如果您正苦于以下问题:C# Store.AddReasoner方法的具体用法?C# Store.AddReasoner怎么用?C# Store.AddReasoner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Store
的用法示例。
在下文中一共展示了Store.AddReasoner方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnLoad
protected override void OnLoad(EventArgs e)
{
RdfStore = new MemoryStore();
RdfStore.Import(
new RdfXmlReader(@"c:\temp\_1.rdf"));
string depRules = @"
@prefix n: <urn:schemas-nreco:metadata:terms#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
{ ?a n:dependentFrom ?b . ?b n:dependentFrom ?c .} => {?a n:dependentFrom ?c}.
{ ?a n:dependentFrom ?b } => { ?b n:usedBy ?a}.
{ ?a n:usedBy ?b . ?b n:usedBy ?c .} => {?a n:usedBy ?c}.
";
Euler engine = new Euler(new N3Reader(new StringReader(depRules)));
RdfStore.AddReasoner(new RDFS(RdfStore));
RdfStore.AddReasoner(engine);
string rdfQuery = @"
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix p: <urn:schemas-nreco:metadata:dotnet:property#>.
@prefix t: <urn:schemas-nreco:metadata:dotnet:type#>.
@prefix w: <file:///d:/Vitalik/GoogleCode/NReco/examples/NReco.Examples.WebApp/web/#>.
@prefix cso: <http://cos.ontoware.org/cso#>.
@prefix n: <urn:schemas-nreco:metadata:terms#>.
w:db n:usedBy ?t2.
";
Query query = new GraphMatch(new N3Reader(new StringReader(rdfQuery)));
StringWriter wr = new StringWriter();
QueryResultSink sink = new SparqlXmlQuerySink(wr);
query.Run(RdfStore, sink);
Result = wr.ToString();
base.OnLoad(e);
}
示例2: Main
public static void Main(string[] args)
{
if (args.Length < 2) {
Console.WriteLine("Usage: euler.exe axioms.n3 axioms... {questions.n3 | -sparql query.sparql}");
return;
}
// Load Axioms
bool sparql = false;
MemoryStore axioms = new MemoryStore();
for (int i = 0; i < args.Length-1; i++) {
if (i > 0 && i == args.Length-2 && args[i] == "-sparql") {
sparql = true;
break;
}
N3Reader axiomsreader = new N3Reader(args[i]);
axiomsreader.BaseUri = "http://www.example.org/arbitrary/base#";
axioms.Import(axiomsreader);
}
Euler engine = new Euler(axioms);
// Load question
if (!sparql) {
MemoryStore question = new MemoryStore();
question.Import(new N3Reader(args[args.Length-1]));
Proof[] proofs = engine.Prove(null, question.ToArray());
foreach (Proof p in proofs) {
Console.WriteLine(p.ToString());
}
} else {
using (StreamReader fs = new StreamReader(args[args.Length-1])) {
string q = fs.ReadToEnd();
Store store = new Store();
store.AddReasoner(engine);
SparqlEngine s = new SparqlEngine(q);
s.Run(store, Console.Out);
}
}
}