public HttpResponseMessage InferredGet(string text, double latitude, double longitude) { UnionGraph resultsGraph = GetUnionGraph(); Graph outputGraph = new Graph(); //resultsGraph.NamespaceMap.AddNamespace("dbo", new Uri("http://dbpedia.org/ontology/")); Graph ontology = new Graph(); FileLoader.Load(ontology, System.AppDomain.CurrentDomain.BaseDirectory.ToString() + Constants.Ontology); StaticRdfsReasoner reasoner = new StaticRdfsReasoner(); reasoner.Initialise(ontology); reasoner.Apply(resultsGraph, outputGraph); Collection<BaprLocation> locations = ExtractResults(resultsGraph, GetInferredPlaces(outputGraph)); return Request.CreateResponse(HttpStatusCode.OK, locations); }
/// <summary> /// Runs the rules inherent in the MyLo schema in N3 format using a static Reasoner /// </summary> public void MyLoSchemaReasoner() { Graph schema = new Graph(); try { FileLoader.Load(schema, @"../../../MyLoSchema.n3"); } catch (RdfParseException parseEx) { Debug.WriteLine("Parser Error - reading MyLoSchema.n3"); Debug.WriteLine(parseEx.Message); } catch (RdfException rdfEx) { Debug.WriteLine("RDF Error - reading MyLoSchema.n3"); Debug.WriteLine(rdfEx.Message); } StaticRdfsReasoner reasoner = new StaticRdfsReasoner(); try { reasoner.Initialise(schema); foreach (IGraph g in _store.Graphs) { reasoner.Apply(g); } } catch (Exception rdfEx) { Debug.WriteLine("Rules Error - applying RDFS Reasoner"); Debug.WriteLine(rdfEx.Message); } }