Closed white-gecko closed 9 years ago
So you mean Saft has to get the default graph and add the statements to it? I am not sure how to implement that. Do you have more information about the default graph and maybe how it is handled by Virtuoso?
Yes, it is handled by just not specifying any graph information.
“This snippet describes two RDF triples to be inserted into the default graph of the Graph Store.”
PREFIX dc: <http://purl.org/dc/elements/1.1/>
INSERT DATA
{
<http://example/book1> dc:title "A new book" ;
dc:creator "A.N.Other" .
}
From http://www.w3.org/TR/2013/REC-sparql11-update-20130321/#insertData (Example 1)
If you execute
INSERT DATA {<http://s/> <http://p/> <http://o/> . }
using Virtuoso 6.1.8 you will get the following error:
Exception: SQLSTATE[42000]: Syntax error or access violation: 0
[OpenLink][Virtuoso iODBC Driver][Virtuoso Server]SQ074:
Line 1: SP031: SPARQL compiler: No default graph specified in
the preamble, but it is needed for triple in INSERT DATA {...} without
GRAPH {...}
(SQLPrepare[0] at /build/buildd/php5-5.4.40+real/ext/pdo_odbc/odbc_driver.c:206)
It seems we just have to add something like GRAPH ?g to it, according to this.
Well, but the SPARQL standard says it should be possible, so I've created an issue: https://github.com/openlink/virtuoso-opensource/issues/417
In case Virtuoso does not support that, we could implement an option, to emulate that behavior. One way could be to use a default URI which acts as the default graph, which can be overridden by the user.
But the standard case would be to throw an exception, that this is not supported by Virtuoso.
HughWilliams said:
[...] but for SPARQL update operations you need to specify which graph in the quad store an insert/update/delete operation should be performed against
That means we have to implement that by ourselves. So as we discussed earlier and i already stated here:
[...] use a default URI which acts as the default graph, which can be overridden by the user. But the standard case would be to throw an exception, that this is not supported by Virtuoso.
I will implement that soon.
You have to set the options key emulateAddStmtToDefaultGraph to true, if you want to emulate that behavior.
The backends HttpStore and ARC2 must handle that case too!
I think we can not add a test for that to the StoreAbstractTest, because each store backend may reaction different. So i would like to test that in the according backend test, such as VirtuosoTest.php.
Or we just leave the default graph as it is and consider it as write protected, if the implementation doesn't allow write access.
Ok, if you think. That is fine for me too. So you mean we just throw an exception if the backend does not grant write access to default graph. No emulation, maybe in 0.2 or later?
Virtuoso addition will throw an exception if you want to add or delete statements with no graph information given (=default graph).
ARC2 addition supports adding and deleting statements in the default graph. No further adaptions needed.
HttpStore may support adding and deleting statements in the default graph, which means, that you can not tell at the code level, if addStatements or deleteMatchingStatements will work or not, because you (usually) dont know what triple-/quadstore runs behind the endpoint.
That issue can be closed. I think we should open a new one, if we decide to implement the emulation to grant write acess to default graph.
Its not possible to add Statements to the default graph. This is apparent when one adds a Triple-Statement (not a Quad) using
addStatements
on theStore
without a$graph
specified.This bug is tested with a new test case introduced in e003195499b50bb141a8de4dcaf91bd8c212a74e