Last modified: 2012-10-17 16:07:13 UTC
INSERT DATA and DELETE DATA requests generated by SMW_SparqlDatabase.php have illegal syntax when the default graph is not set: they have double curly brackets around the data: INSERT DATA {{ ... }} Here is a fix for the insertData function: public function insertData( $triples, $extraNamespaces = array() ) { if ( $this->m_dataEndpoint !== '' ) { $turtle = self::getPrefixString( $extraNamespaces, false ) . $triples; return $this->doHttpPost( $turtle ); } else { $sparql = self::getPrefixString( $extraNamespaces, true ) . "INSERT DATA { " . ( ( $this->m_defaultGraph !== '' )? "GRAPH <{$this->m_defaultGraph}> { " : '' ) . " $triples } "; // close extra curly bracket for graph clause ( ( $this->m_defaultGraph !== '' )? " } " : " "; return $this->doUpdate( $sparql ); } } Same should work for deleteData as well. I have not verified if this same problem occurs anywhere else.
Created attachment 11090 [details] patched file for properly use of default graph in SPARQL/Update query patched file for properly use of default graph in SPARQL/Update query
I solved this problem modifying "\extensions\SemanticMediaWiki\includes\sparql\SMW_SparqlDatabase.php" I update -public function insertData( $triples, $extraNamespaces = array() ) {...} to fix the use of default graph -public function doQuery( $sparql ) to add content type and charset -public function doUpdate( $sparql ) to add content type and charset I attach the patched file, so you have to download and substitute the old one.
Comment on attachment 11090 [details] patched file for properly use of default graph in SPARQL/Update query [Correcting MIME Type and setting patch flag]
Fixed by applying the suggested patch in https://gerrit.wikimedia.org/r/#/c/28369/