From: Rob V. <rv...@do...> - 2011-05-06 10:37:31
|
Hi Andrew Thanks for the feedback Firstly with regards to your issue I would point you to the SPARQL Specification section on Blank Node Labels in Query Results (http://www.w3.org/TR/rdf-sparql-query/#BlankNodesInResults) which states the following: "Blank node labels are scoped to a result set (as defined in "SPARQL Query Results XML Format <http://www.w3.org/TR/rdf-sparql-XMLres/> ") or, for the CONSTRUCT query form, the result graph. Use of the same label within a result set indicates the same blank node." For SELECT queries the library will return the original Blank Node labels but for CONSTRUCT/DESCRIBE queries it is necessary to rewrite the labels to avoid any collisions between Blank Nodes that originate from different Graphs. Blank Node labels are just a convenient way of distinguishing between nodes in a particular serialization, they should not really be relied upon for identifying nodes wherever possible. The additional parts in the names you see are actually hash codes of the originating graph of the node, if you really wanted to you could use this to determine the graph the node originated from but I wouldn't recommend this approach. There is no way to turn off this behaviour as doing so would break the implementation of CONSTRUCT and DESCRIBE. What I would suggest is that you use a SELECT query to find the blank nodes you are interested in and then use the results to issue GetTriplesWithX() calls against your graphs to do further searches. You can also use the special syntax <_:id> in SPARQL queries to search for nodes with specific IDs but this is a non-standard SPARQL feature so again I would not rely on it. This needs you to have enable Extended syntax for the SparqlQueryParser instance you use to parse your queries. If you have further questions or issues please let me know Regards, Rob Vesse From: Andrew Abramov [mailto:sti...@gm...] Sent: 05 May 2011 15:19 To: rv...@do... Subject: dotNetRDF API SPARQL CONSTRUCT issue Hi, Rob! Let me say many thanks for your amazing library dotNetRDF. It's the great product! This library is my pass to the world of RDF. But I still have some misunderstandings. One of these is the construction of new graphs by the SPARQL CONSTRUCT query. It works. But the blank nodes created by this query have additional part in they names. These parts seems like the timestamp, separated from the original name by the minus sign. In my tasks will be better to avoid such additions. Because I construct the really new graphs - they are just the "reflections" of the original graph. And the changes of the node names makes me trouble to search orignal data on original graph. Maybe this approach (search data by the name of the node ) isn't "clear RDF way", but it makes the code and logic more clearly. Thus, I have a question. Can I avoid add-ons in the blank node names when creating new graph by the CONSTRUCT query? Thanks in advance WBR Andrew Abramov AKA Stinger |