https://bugzilla.wikimedia.org/show_bug.cgi?id=37575

       Web browser: ---
             Bug #: 37575
           Summary: Syntax error in SPARQL INSERT/DELETE DATA requests
                    when default graph not set
           Product: MediaWiki extensions
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: Unprioritized
         Component: Semantic MediaWiki
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified
   Mobile Platform: ---


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.

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to