|
From: Rob V. <rv...@do...> - 2014-01-13 16:45:02
|
Christopher Thanks for the report, this was indeed a bug which has been filed as CORE-394 (http://dotnetrdf.org/tracker/Issues/IssueDetail.aspx?&id=394) This has been fixed on our default branch and will be included in the next release Regards, Rob Vesse From: "Penny, Christopher" <Chr...@ds...> Reply-To: dotNetRDF Bug Report tracking and resolution <dot...@li...> Date: Monday, 13 January 2014 05:32 To: "dot...@li..." <dot...@li...> Subject: [dotNetRDF-bugs] Storing Named Graphs in Fuseki Omit URI Fragment [SEC=UNCLASSIFIED] > UNCLASSIFIED > > Hi All, > > It appears as though the fragment part (# onwards) of the graphs BaseUri is > not being saved to the Fuseki server. Below is a quick example to demonstrate > what I mean. > > privatevoid graphURIFragmentProblemExample(string fusekiTripleStore) > { > //Setup graph > IGraph graph = newGraph(); > graph.BaseUri = newUri("http://test.com/test#graph1"); > graph.NamespaceMap.AddNamespace("data", > UriFactory.Create("http://test.com/test#")); > > //Create nodes and a tuple > IUriNode subject1Node = graph.CreateUriNode("data:subject1"); > IUriNode object1Node = graph.CreateUriNode("data:object1"); > IUriNode subject2Node = graph.CreateUriNode("data:subject2"); > IUriNode object2Node = graph.CreateUriNode("data:object2"); > IUriNode predicateNode = graph.CreateUriNode("data:predicate"); > graph.Assert(newTriple(subject1Node, object1Node, predicateNode)); > graph.Assert(newTriple(subject2Node, object2Node, predicateNode)); > > //Print out local graph > System.Console.WriteLine("Printing local graph"); > CompressingTurtleWriter writer = newCompressingTurtleWriter(); > var sw = new System.IO.StringWriter(); > writer.Save(graph, sw); > Console.WriteLine(sw.ToString()); > > //Save graph to triplestore > FusekiConnector store = > newFusekiConnector(newUri(fusekiTripleStore)); > store.SaveGraph(graph); > > //Query store for all data, including the graph it belongs to > StringBuilder sb = newStringBuilder(); > sb.Append("select ?graph ?subject ?predicate > ?object"+Environment.NewLine); > sb.Append("where" + Environment.NewLine); > sb.Append("{" + Environment.NewLine); > sb.Append("GRAPH ?graph" + Environment.NewLine); > sb.Append("{" + Environment.NewLine); > sb.Append("?subject ?predicate ?object" + Environment.NewLine); > sb.Append("}" + Environment.NewLine); > sb.Append("}" + Environment.NewLine); > > Object results = store.Query(sb.ToString()); > SparqlResultSet rset = (SparqlResultSet)results; > > //Print results > System.Console.WriteLine("Printing query results"); > foreach (SparqlResult r in rset) > { > System.Console.WriteLine(r.ToString()); > } > } > > Output: > Printing local graph > @base <http://test.com/test#graph1>. > > @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. > @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. > @prefix xsd: <http://www.w3.org/2001/XMLSchema#>. > @prefix data: <http://test.com/test#>. > > <http://test.com/test#subject1> <http://test.com/test#object1> > <http://test.com/test#predicate>. > <http://test.com/test#subject2> <http://test.com/test#object2> > <http://test.com/test#predicate>. > > Printing query results > ?graph = http://test.com/test , ?subject = http://test.com/test#subject1 , > ?predicate = http://test.com/test#object1 , ?object = > http://test.com/test#predicate > ?graph = http://test.com/test , ?subject = http://test.com/test#subject2 , > ?predicate = http://test.com/test#object2 , ?object = > http://test.com/test#predicate > > As can be seen, the #graph1 component of the graph¹s URI hasn¹t been bound to > the ?graph variable of the query (although it is present in the local graph > object). Additionally, I tried doing the above with Apache-Jena components. > Using s-query to execute following query confirms the missing fragment from > the graph URI: > > Command line: > ${JENA_HOME}/s-query --service ${FUSEKI_SERVER}/query --query > ${TURTLE_HOME}/query.arq > > Where query.arq contains the query: > > select ?g ?s ?p ?o > where > { > GRAPH ?g > { > ?s ?p ?o . > } > } > > The results are as follows (note the missing #graph1): > > { > "head": { > "vars": [ "g" , "s" , "p" , "o" ] > } , > "results": { > "bindings": [ > { > "g": { "type": "uri" , "value": "http://test.com/test" } , > "s": { "type": "uri" , "value": "http://test.com/test#subject1" } , > "p": { "type": "uri" , "value": "http://test.com/test#object1" } , > "o": { "type": "uri" , "value": "http://test.com/test#predicate" } > } , > { > "g": { "type": "uri" , "value": "http://test.com/test" } , > "s": { "type": "uri" , "value": "http://test.com/test#subject2" } , > "p": { "type": "uri" , "value": "http://test.com/test#object2" } , > "o": { "type": "uri" , "value": "http://test.com/test#predicate" } > } > ] > } > } > > In an attempt to eliminate Fuseki as a souce of the problem I inserted the > same triples into the same graph using Apache-Jena: > > Command line: > ${JENA_HOME}/s-put ${FUSEKI_SERVER}/data http://test.com/test#graph1 > named_graph_bug_example.ttl > > Where ³named_graph_bug_example.ttl² contains the following content: > > PREFIX data: <http://test.com/test#> > > data:subject1 data:predicate data:object1 . > data:subject2 data:predicate data:object2 . > > Rerunning the original command now shows the new tuples in a graph with the > correct URI (alongside the old tuples): > > { > "head": { > "vars": [ "g" , "s" , "p" , "o" ] > } , > "results": { > "bindings": [ > { > "g": { "type": "uri" , "value": "http://test.com/test" } , > "s": { "type": "uri" , "value": "http://test.com/test#subject1" } , > "p": { "type": "uri" , "value": "http://test.com/test#object1" } , > "o": { "type": "uri" , "value": "http://test.com/test#predicate" } > } , > { > "g": { "type": "uri" , "value": "http://test.com/test#graph1" } , > "s": { "type": "uri" , "value": "http://test.com/test#subject1" } , > "p": { "type": "uri" , "value": "http://test.com/test#predicate" } , > "o": { "type": "uri" , "value": "http://test.com/test#object1" } > } , > { > "g": { "type": "uri" , "value": "http://test.com/test#graph1" } , > "s": { "type": "uri" , "value": "http://test.com/test#subject2" } , > "p": { "type": "uri" , "value": "http://test.com/test#predicate" } , > "o": { "type": "uri" , "value": "http://test.com/test#object2" } > } , > { > "g": { "type": "uri" , "value": "http://test.com/test" } , > "s": { "type": "uri" , "value": "http://test.com/test#subject2" } , > "p": { "type": "uri" , "value": "http://test.com/test#object2" } , > "o": { "type": "uri" , "value": "http://test.com/test#predicate" } > } > ] > } > } > > It¹s entirely possible that I¹ve misunderstood how to set a graph¹s URI in > dotnetRDF, but it looks like there may be another problem here. Let me know if > you need any more information. > > Regards, Chris. > IMPORTANT: This email remains the property of the Department of Defence and is > subject to the jurisdiction of section 70 of the Crimes Act 1914. If you have > received this email in error, you are requested to contact the sender and > delete the email. > ------------------------------------------------------------------------------ > CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More > Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development > Environments & Everything In Between. Get a Quote or Start a Free Trial Today. > http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk__ > _____________________________________________ dotNetRDF-bugs mailing list > dot...@li...://lists.sourceforge.net/lists/listin > fo/dotnetrdf-bugs |