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); }
public void LoadAnnotationOntologyFromString(string rdfData) { _conceptsStore = new MemoryStore(); RdfXmlReader reader = new RdfXmlReader(new System.IO.StringReader(rdfData)); _conceptsStore.Import(reader); UpdateDictionaries(); }
public void LoadAnnotationOntologyFromFile(string filename) { _conceptsStore = new MemoryStore(); AddEventAndLog("Loading annotation ontology from file: " + filename); _conceptsStore.Import(RdfReader.LoadFromUri(new Uri(filename))); UpdateDictionaries(); }