From: <tr...@do...> - 2014-03-21 10:23:11
|
<p>The following issue has been added to a project that you are monitoring.</p> <table border="0"> <tr> <td width="90px" valign="top"><b>Title:</b></td> <td>Blank nodes not created correctly for loaded graph after restarting program</td> </tr> <tr> <td><b>Project:</b></td> <td>Core Library (dotNetRDF.dll)</td> </tr> <tr> <td><b>Created By:</b></td> <td>Marek Obitko</td> </tr> <tr> <td><b>Milestone:</b></td> <td>Unassigned</td> </tr> <tr> <td><b>Category:</b></td> <td>Update</td> </tr> <tr> <td><b>Priority:</b></td> <td>Unassigned</td> </tr> <tr> <td><b>Type:</b></td> <td>Bug</td> </tr> <tr> <td><b>Description:</b></td> </tr> <tr> <td colspan="2"><p> Steps to reproduce (see also code below):</p> <p> 1. Create data with a blank node, for example using INSERT DATA { [ <http://mapping/left> "item1"; <http://mapping/right> "item2" ] }</p> <p> 2. Save to file</p> <p> 3. Stop and start the program again (important, this doesn't happen in one run)</p> <p> 4. Add another blank node, e.g. by INSERT DATA { [ <http://mapping/left> "item3"; <http://mapping/right> "item4" ] }</p> <p> 5. Observe that the new blank node is merged with the original blank node. When multiple blank nodes are created, they are merged together one by one. It seems (but doesn't have to be) that the problem is that the numbering autosX ID of blank node starts with the same X, even if autosX already exists in the loaded graph.</p> <p> </p> <p> Not using any 3rd party storage. See also examples below.</p> <p> </p> <p> Code demonstrating the bug is as follows:</p> <p> public void DemonstrateBug()<br /> {<br /> if (!File.Exists(@"c:\mapping1.xml"))<br /> {<br /> // first pass - create blank node<br /> IGraph graph = new Graph();<br /> TripleStore tripleStore = new TripleStore();<br /> tripleStore.Add(graph);<br /> SparqlUpdateParser parser = new SparqlUpdateParser();<br /> SparqlParameterizedString cmdString = new SparqlParameterizedString();<br /> <br /> cmdString.CommandText = @"INSERT DATA { [ <http://mapping/left> ""item1""; <http://mapping/right> ""item2"" ] }";<br /> <br /> SparqlUpdateCommandSet cmds = parser.ParseFromString(cmdString);<br /> LeviathanUpdateProcessor processor = new LeviathanUpdateProcessor(tripleStore);<br /> processor.ProcessCommandSet(cmds);<br /> <br /> RdfXmlWriter rdfXmlWriter = new RdfXmlWriter();<br /> rdfXmlWriter.Save(graph, @"c:\mapping1.xml");<br /> rdfXmlWriter.Save(graph, @"c:\mapping.xml");<br /> }<br /> else<br /> {<br /> // second pass - read file and add a new blank node<br /> IGraph graph = new Graph();<br /> TripleStore tripleStore = new TripleStore();<br /> tripleStore.Add(graph);<br /> <br /> RdfXmlParser rdfXmlParser = new RdfXmlParser();<br /> rdfXmlParser.Load(graph, @"c:\mapping.xml");<br /> <br /> SparqlUpdateParser parser = new SparqlUpdateParser();<br /> SparqlParameterizedString cmdString = new SparqlParameterizedString();<br /> <br /> cmdString.CommandText = @"INSERT DATA { [ <http://mapping/left> ""item3""; <http://mapping/right> ""item4"" ] }";<br /> <br /> SparqlUpdateCommandSet cmds = parser.ParseFromString(cmdString);<br /> LeviathanUpdateProcessor processor = new LeviathanUpdateProcessor(tripleStore);<br /> processor.ProcessCommandSet(cmds);<br /> <br /> RdfXmlWriter rdfXmlWriter = new RdfXmlWriter();<br /> rdfXmlWriter.Save(graph, @"c:\mapping.xml");<br /> rdfXmlWriter.Save(graph, @"c:\mapping2.xml");<br /> }<br /> }</p> <p> </p> <p> The first run produces</p> <p> <rdf:RDF xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><br /> <rdf:Description rdf:nodeID="autos1"><br /> <ns0:left xmlns:ns0="http://mapping/">item1</ns0:left><br /> <ns1:right xmlns:ns1="http://mapping/">item2</ns1:right><br /> </rdf:Description><br /> </rdf:RDF></p> <p> and the second run produces incorrectly</p> <p> <rdf:RDF xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:ns0="http://mapping/" xmlns:ns1="http://mapping/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><br /> <rdf:Description rdf:nodeID="autos1"><br /> <ns1:left>item1</ns1:left><br /> <ns1:left>item3</ns1:left><br /> <ns1:right>item2</ns1:right><br /> <ns1:right>item4</ns1:right><br /> </rdf:Description><br /> </rdf:RDF></p> <p> but I would expect correct</p> <p> <rdf:RDF xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:xml="http://www.w3.org/XML/1998/namespace" xmlns:ns0="http://mapping/" xmlns:ns1="http://mapping/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><br /> <rdf:Description rdf:nodeID="autos1"><br /> <ns1:left>item1</ns1:left><br /> <ns1:right>item2</ns1:right><br /> </rdf:Description><br /> <rdf:Description rdf:nodeID="autos2"><br /> <ns1:left>item3</ns1:left><br /> <ns1:right>item4</ns1:right><br /> </rdf:Description><br /> </rdf:RDF></p> <p> which is produced when the code above is run twice within one program run.</p> <p> Thanks for looking at it!</p> <p> </p> <p> </p> <p> </p></td> </tr> </table> <p> More information on this issue can be found at <a href="http://www.dotnetrdf.org/tracker/Issues/IssueDetail.aspx?id=404" target="_blank">http://www.dotnetrdf.org/tracker/Issues/IssueDetail.aspx?id=404</a></p> <p style="text-align:center;font-size:8pt;padding:5px;"> If you no longer wish to receive notifications, please visit <a href="http://www.dotnetrdf.org/tracker/Account/UserProfile.aspx" target="_blank">your profile</a> and change your notifications options. </p> |