|
From: Rob V. <rv...@do...> - 2012-08-01 00:18:27
|
Well it looks like the update works but the query doesn't Btw your query appears to be wrong for the expected data, shouldn't it be more like the following: prefix ex: <http://www.example.com/> prefix rr: <http://www.w3.org/ns/r2rml#> select * where { ex:triplesMap rr:predicateObjectMap ?predObjMap . ?predObjMap rr:objectMap ?map . ?map rr:constant ?value } Even with this revised query the test still fails, I suspect this is some sort of bug causes by the construction of fresh blank nodes in the course of an update creating them in a way that means that they don't properly evaluate to equal and thus join in subsequent queries. I am investigating and will get back to you when I know what the cause is and/or have a fix Thanks, Rob On 7/31/12 1:05 PM, "Tomasz Pluskiewicz" <tom...@gm...> wrote: >Hi > >This is a follow-up to an issue I have already had before. I have a >graph on which I perform a DELETE/INSERT. All works fine with URI >nodes, but when I have some blank nodes it stops. Below is a test >case, which illustrates my issue. > >Is this expected result? I guess it has something to do with the scope >of blank nodes in SPARQL update but the graphs serialized are like two >peas in a pod. How could I rewrite this update? > >private const string InitialGraph = >@"@prefix ex: <http://www.example.com/>. >@prefix rr: <http://www.w3.org/ns/r2rml#>. > >ex:triplesMap rr:predicateObjectMap _:blank . >_:blank rr:object ex:Employee, ex:Worker ."; > > private const string ReplaceConstantsSparql = >@"PREFIX rr: <http://www.w3.org/ns/r2rml#> > >DELETE { ?map rr:object ?value . } >INSERT { ?map rr:objectMap [ rr:constant ?value ] . } >WHERE { ?map rr:object ?value }"; > > private const string QuerySparql = >@"prefix ex: <http://www.example.com/> >prefix rr: <http://www.w3.org/ns/r2rml#> > >select * >where >{ >ex:triplesMap rr:predicateObjectMap ?map . >?map rr:constant ?value >}"; > > const string ExpectedGraph = >@"@prefix ex: <http://www.example.com/>. >@prefix rr: <http://www.w3.org/ns/r2rml#>. > >ex:triplesMap rr:predicateObjectMap _:blank. >_:blank rr:objectMap _:autos1. >_:autos1 rr:constant ex:Employee. >_:autos2 rr:constant ex:Worker. >_:blank rr:objectMap _:autos2."; > > [Test] > public void Test() > { > // given > IGraph graph = new Graph(); > graph.LoadFromString(InitialGraph); > IGraph expectedGraph = new Graph(); > expectedGraph.LoadFromString(ExpectedGraph); > > // when > TripleStore store = new TripleStore(); > store.Add(graph); > > var dataset = new InMemoryDataset(store, graph.BaseUri); > ISparqlUpdateProcessor processor = new >LeviathanUpdateProcessor(dataset); > var updateParser = new SparqlUpdateParser(); > > >processor.ProcessCommandSet(updateParser.ParseFromString(ReplaceConstantsS >parql)); > > // then > >Assert.IsTrue(((SparqlResultSet)graph.ExecuteQuery(QuerySparql)).Any()); >// this fails > } > >Thanks in advance, >Tomasz > >-------------------------------------------------------------------------- >---- >Live Security Virtual Conference >Exclusive live event will cover all the ways today's security and >threat landscape has changed and how IT managers can respond. Discussions >will include endpoint security, mobile security and the latest in malware >threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >_______________________________________________ >dotNetRDF-bugs mailing list >dot...@li... >https://lists.sourceforge.net/lists/listinfo/dotnetrdf-bugs |