Hello,
I am quite new to LinkedWiki, but have been playing with it in localhost MW instance, along with Fuseki. It is really interesting combination. Ultimately I would like to "mirror" all the semantic property:value pairs on to a Fuseki dataset, but at the moment I am struggling to do inserts from MW to the Fuseki SPARQL endpoint. an I wondering if I could get some help here :)
I am running:
- MediaWiki 1.34.1
- PHP 7.3.14-1~deb10u1 (apache2handler)
- MariaDB 10.3.22-MariaDB-0+deb10u1
- Semantic MediaWiki3.1.6
In the Special:SparqlQuery I can perform SELECT queries no problem.
However, when I try to perform the following insert, I get Error message: Sorry, you have not configure the endpoint to update the database.
Which is strange since the same statement run just fine in the SPARQL Flint editor
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
DELETE
{ foaf:Person foaf:name "Sara" . }
INSERT
{ foaf:Person foaf:name "Zara" . }
WHERE { foaf:Person foaf:name "Sara" . }
Or with a POST request via curl
curl http://localhost:3030/beerwiki/ -X POST --data 'update=%0APREFIX+foaf%3A+%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2F%3E%0A%0ADELETE%0A%7B%0A++++foaf%3APerson+foaf%3Aname+%22Sara%22+.+%0A%7D%0AINSERT%0A%7B%0A%09foaf%3APerson+foaf%3Aname+%22Zara%22+.+++%0A%7D%0AWHERE+%7B%0A%09foaf%3APerson+foaf%3Aname+%22Sara%22+.+++%0A%7D' -H 'Accept: text/plain,*/*;q=0.9'
Here is my InterWiki setting in LocalSettings.php
wfLoadExtension( 'LinkedWiki' );
$wgAutoloadClasses['BeerwikiStorageMethod'] = "$IP/extensions/LinkedWiki/storageMethod/BeerwikiStorageMethod.php";
$wgLinkedWikiConfigSPARQLServices["http://localhost/beerwiki"] = array(
"debug" => true,
"isReadOnly" => false,
"typeRDFDatabase" => "fuseki",
"endpointRead" => "http://localhost:3030/beerwiki/",
"endpointWrite" => "http://localhost:3030/beerwiki/",
"login" => "admin",
"password" => "pw123",
"HTTPMethodForRead" => "POST",
"HTTPMethodForWrite" => "POST",
"lang" => "en",
"nameParameterRead" => "query",
"nameParameterWrite" => "update",
"storageMethodClass" => "BeerwikiStorageMethod"
);
$wgLinkedWikiSPARQLServiceSaveDataOfWiki= "http://localhost:3030/beerwiki/";
And the BeerwikiStorageMethod.php
<?php
class BeerwikiStorageMethod extends StorageMethodAbstract {
/**
* @return string
*/
private $graphNamed = "http://localhost/beerwiki";
public function getQueryReadStringWithTagLang() {
return <<<EOT
SELECT DISTINCT ?value
WHERE
{
?subject ?property ?value .
FILTER ( lang(?value) = ?lang )
}
EOT;
}
/**
* @return string
*/
public function getQueryReadStringWithoutTagLang() {
return <<<EOT
SELECT DISTINCT ?value
WHERE
{
?subject ?property ?value .
FILTER ( lang(?value) = "" )
}
EOT;
}
/**
* @return string
*/
public function getQueryReadValue() {
return <<<EOT
SELECT DISTINCT ?value
WHERE
{
?subject ?property ?value .
}
EOT;
}
/**
* @return string
*/
public function getQueryInsertValue() {
return <<<EOT
INSERT DATA
{
?subject ?property ?value .
}
EOT;
}
/**
* @return string
*/
public function getQueryDeleteSubject() {
return <<<EOT
DELETE
{ ?subject ?property ?value . }
WHERE
{ ?subject ?property ?value . }
EOT;
}
/**
* @param string $url
* @return string
*/
public function getQueryLoadData( $url ) {
return "";
}
}