Author: jeen.broekstra
Description:
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.
Version: unspecified
Severity: major