Extension talk:LinkedWiki

About this board

Fail to insert to SPARQL endpoint

9
193.170.253.73 (talkcontribs)

Hello!

I am struggling to do insert from Mediawiki 1.39.5 to GraphDB SPARQL endpoint. I have installed the LinkedWiki 3.7.1 compatible with MW. Also, i am running SMW 4.1.1, PHP 8.1.2 and MySQL 8.0.35

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 GraphDB sparql endpoint

PREFIX dc: <http://purl.org/dc/elements/1.1/>
INSERT {
         GRAPH <http://example> {
          <http://example/book2> dc:title "A new book2" ;
                                 dc:creator "A.N.Other2" .
         }

Here is my setting in LocalSettings.php

wfLoadExtension( 'LinkedWiki' );

$wgAutoloadClasses['GraphdbStorageMethod'] = "$IP/extensions/LinkedWiki/storageMethod/GraphdbStorageMethod.php";

$wgLinkedWikiConfigSPARQLServices["http://localhost/graphdb"] = array(
	"debug" => true,
	"isReadOnly" => false,
	"typeRDFDatabase" => "graphdb",
	"endpointRead" => "http://localhost:3030/graphdb/myrepository",
	"endpointWrite" => "http://localhost:3030/graphdb",
	"login" => "test",
	"password" => "test",
	"HTTPMethodForRead" => "POST",
	"HTTPMethodForWrite" => "POST",
	"lang" => "en",
	"nameParameterRead" => "query",
	"nameParameterWrite" => "update",
    "storageMethodClass" => "GraphdbStorageMethod"
);

$wgLinkedWikiSPARQLServiceSaveDataOfWiki= "http://localhost:3030/graphdb";

And the GraphdbStorageMethod.php

<?php

class GraphdbStorageMethod extends StorageMethodAbstract {
    /**
     * @return string
     */

    private $graphNamed = "http://localhost/graphdb"; 

    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 "";
    }

}
193.170.253.73 (talkcontribs)

I also noticed this while using {{#sparql ..}} in a page and used the same query that it sent wrong "POST" request to the SPARQL server. Instead of .../sparql?update=... it is sending .../sparql?query=...

Karima Rafes (talkcontribs)
193.170.253.73 (talkcontribs)

Thank you for the quick response and the information. I have changed the variable but i am still getting the same error.

Karima Rafes (talkcontribs)

I didn't test with GraphDB but I think, it's a problem in the configuration. You can use the special page LinkedWiki to check each parameter in your configuration.

193.170.253.73 (talkcontribs)

Special page LinkedWiki has the same parameters, which i defined in my LocalSettings.php.

$wgLinkedWikiConfigSPARQLServices["http://localhost/graphdb"] = array( "debug" => true, "isReadOnly" => false, "typeRDFDatabase" => "graphdb", "endpointRead" => "http://localhost/graphdb/myrepository", "endpointWrite" => "http://localhost/graphdb/myrepository/statements", "login" => "test", "password" => "test", "HTTPMethodForRead" => "POST", "HTTPMethodForWrite" => "POST", "lang" => "en", "nameParameterRead" => "query", "nameParameterWrite" => "update",

   "storageMethodClass" => "GraphdbStorageMethod"

);

$wgLinkedWikiSPARQLServiceSaveDataOfWiki= "http://localhost/graphdb";

I don't know what is the exact issue.

Karima Rafes (talkcontribs)

Try, debug= false

Karima Rafes (talkcontribs)

What is your version of PHP? 7 is only supported for the moment (php8 is not supported by MediaWiki officially)

If there is always a problem with php7: OPTION A: if you pay a license GraphDB, you can probably ask the help of GraphDB support to open the PHP code. OPTION B: switch on another database OPTION C: debug the PHP code yourself and send me the fix ;)

193.170.253.73 (talkcontribs)

I am using php 8 and I am using free version of GraphDB. If php version is causing the problem then i will try with php7 and then update you about the issue.

Reply to "Fail to insert to SPARQL endpoint"

composer installation not compatible with node.js 18

4
134.34.200.62 (talkcontribs)

The composer installation fails with the following errors


# composer install --no-dev

...

1.169 [1/4] Resolving packages...

2.133 warning popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1

11.49 [2/4] Fetching packages...

23.38 error eslint-plugin-jsdoc@39.2.2: The engine "node" is incompatible with this module. Expected version "^14 || ^16 || ^17". Got "18.17.1"

23.40 error Found incompatible module.

Karima Rafes (talkcontribs)
134.34.200.62 (talkcontribs)

npm install --production=true instead of yarn install --production=true fixed the error

Karima Rafes (talkcontribs)

I updated the packages in the last version. (master)

Querying multiple sources

3
Jdm.oliveira (talkcontribs)

Is it possible to query multiple endpoints at once (for example, Wikidata, Europeana and our own pages) and then represent the returned properties in a map or data table, as it is possible to do with a single endpoint? I wanted to be able to show common properties between these endpoints and each of their entries.

Karima Rafes (talkcontribs)

In theory yes... LinkedWiki sends the federated query at one endpoint to execute the the query. After this endpoint communicates with other endpoints to resolve the query. Generally, before, you need to enable "federated query processing" in the database (example with Virtuoso).

Jdm.oliveira (talkcontribs)

Thank you for your answer. Sadly my database is not with Virtuoso but with MySQL. I have not found out yet a way that lets me enable federated query processing without isql.

If I try to do a federated query (simply using "SERVICE<http://sparql.europeana.eu/>{}" I also get the following error:

"Sorry, the sparql server sent an error.

Virtuoso 42000 Error SQ070:SECURITY: Must have select privileges on view DB.DBA.SPARQL_SINV_2 SPARQL query"

I am still quite unexperienced with SPARQL, but my idea was to query properties from both endpoints, such as coordinates, and place them on a leaflet map. I can do this only with one endpoint so far.

Reply to "Querying multiple sources"

How to install sgvizler2 in MediaWiki

2
Summary by Karima Rafes
Lotusccong (talkcontribs)

After install the LinkedWiki extnesion, how we can install sgvizler2 ?

Karima Rafes (talkcontribs)

Show blank page in SPARQL results if have | chart=bordercloud.visualization.DataTable

7
Summary by Karima Rafes

Probably an error in the query ... Add | log=2 And | debug=YES else check errors in the console of browser.

Lotusccong (talkcontribs)

As a new beginner in LinkedWiki, I copy the SPARQL Wiki sytax from Linkedwiki.com

It seems that if I included the | chart=bordercloud.visualization.DataTable , it will show blank page.

After I remove it, it did show the results.

Appreciate you can enlight me why this happen ?

Karima Rafes (talkcontribs)
Karima Rafes (talkcontribs)

Can you share the link of the query in Linkedwiki.com ? I will check in my wiki.

Lotusccong (talkcontribs)
Karima Rafes (talkcontribs)

File not found : "/home/sjkcyuhu/public_html/tbpedia.org/book/extensions/LinkedWiki/node_modules/popper.js/dist/umd/popper.min.js"

Does the directory "extensions/LinkedWiki/node_modules" exist ?

If no, you need to go in this the extension folder : cd extensions/LinkedWiki

and execute : yarn install --production=true (or npm install --production)

Lotusccong (talkcontribs)

Got it. I notice that I didn't run the yarn install or npm install after I run the Composer installation. That's why the intallation is incomplete but it show as installed in Special page. my hosting Terminal not support runnning yarn or npm comman but support composer.

Any better way that make the installtion process only required the Composer ?

Karima Rafes (talkcontribs)

When an extension uses a javascript library not avalaible in Mediawiki, there is no other solution than to install it manually. I have to check if Mediawiki 3.6 can now automate the installation of extension libraries with yarn or npm.

Query page using linked wiki

26
Legaulph (talkcontribs)
MediaWiki 1.31.6
PHP 7.3.15 (cgi-fcgi)
MySQL 5.6.41-log
LinkedWiki 3.3.7

I have Pageforms query form That I have been using for some time. after upgrade, The query works, however the links are bad know.

I get:  server.comClient_Firewall/TS-2DRoadmap
it should be: server.com/wiki/Client_Firewall/TS-Roadmap
{{#ifeq: {{{cat|}}} | Technology | 
{{#sparql:
PREFIX property:<server.comProperty-3A>
PREFIX swivt:<http://semantic-mediawiki.org/swivt/1.0#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
SELECT ?Name ?Owner ?Publication_Status ?Start_Date ?End_Date ?Status ?Link
WHERE
        {
            ?Link property:Has_parent_page ?parent.
            ?parent property:PublicationStatus ?Publication_Status .
            ?Link property:Has_subobject ?Subobject .
            ?Subobject property:Technology_Name ?Name .
            ?Subobject property:Has_Start_Date ?Start_Date .
            OPTIONAL {
            ?Subobject property:Has_End_Date ?End_Date .
            }
            ?Subobject property:Has_Support_Status ?Status .
            OPTIONAL {
             ?parent ?p ?sub .
             ?cat rdfs:label ?Category .
             FILTER(CONTAINS(STR(?cat), "Category")) .
             ?sub rdfs:subClassOf ?cat .
             ?sub rdfs:label ?Subcategory .
            }
            {{#ifeq: {{{subcategory|}}} | all | | FILTER regex(?Subcategory, "{{{subcategory|}}}", "i") . }}
            {{#if:{{{tech|}}} | FILTER regex(?Name, "{{{tech|}}}", "i") . }}
            {{#if:{{{tech_owner|}}} | ?Link property:OwnedBy ?Owner . FILTER regex(?Owner, "{{{tech_owner|}}}", "i") . |  OPTIONAL { ?Link property:OwnedBy ?Owner . } }}
            {{#if: {{{tech_contact|}}} | ?Link property:Contact ?Contact . FILTER regex(?Contact, "{{{tech_contact|}}}", "i") . |  }} 
            {{#if: {{{manufactured|}}} | ?parent property:ManufacturedBy ?Manufacturer . FILTER regex(?Manufacturer, "{{{manufactured|}}}", "i") .  | }}
           {{#ifeq: {{{status|}}} | all | | FILTER regex(?Status, "{{{status|}}}", "i") . }}
             {{#ifeq: {{{support|}}} | all | | ?Subobject property:Supported_By ?Support . FILTER regex(?Support, "{{{support|}}}", "i") . }}
}
ORDER BY ?Name ?End_Date
LIMIT 100000
|endpoint=http://serverendpoint.com/sparql}}
 | }} 

Karima Rafes (talkcontribs)
Legaulph (talkcontribs)
It's on a private network.
Legaulph (talk) 12:37, 18 March 2020 (UTC)
Karima Rafes (talkcontribs)

You can also try to reproduce it in the form of your SPARQL service.

Legaulph (talkcontribs)
I'm not sure what you mean. I'm not that fluent in SPARQL.
Karima Rafes (talkcontribs)

The data is not modified by the extension. You must verify that the data is correct in your database.

select distinct ?link where { ?link property:Has_subobject ?Subobject . }

Legaulph (talkcontribs)
I'm using short urls. The SPARQL Query at my endpoint are not adding /wiki/ and leaving out the / before the page name. However when I run the ask query it does bring back the correct link.
I don't know what that means and maybe I should post the question on SMW site?
Legaulph (talk) 14:50, 18 March 2020 (UTC)
Karima Rafes (talkcontribs)

If SMW saves your wiki, it's probably a problem with the SMW's configuration.

Legaulph (talkcontribs)
I check LinkedWiki configuration and this error shows:
[514eb7f4c34734ca0fec92cf] /wiki/Special:LinkedWikiConfig Error from line 29 of D:\xampp\htdocs\mediawiki\extensions\LinkedWiki\specialpages\SpecialLinkedWikiConfig.php: Call to undefined method   OutputPage::addWikiTextAsInterface()
Backtrace:
#0 D:\xampp\htdocs\mediawiki\includes\specialpage\SpecialPage.php(565): SpecialLinkedWikiConfig->execute(NULL)
#1 D:\xampp\htdocs\mediawiki\includes\specialpage\SpecialPageFactory.php(568): SpecialPage->run(NULL)
#2 D:\xampp\htdocs\mediawiki\includes\MediaWiki.php(288): SpecialPageFactory::executePath(Title, RequestContext)
#3 D:\xampp\htdocs\mediawiki\includes\MediaWiki.php(861): MediaWiki->performRequest()
#4 D:\xampp\htdocs\mediawiki\includes\MediaWiki.php(524): MediaWiki->main()
#5 D:\xampp\htdocs\mediawiki\index.php(42): MediaWiki->run()
#6 {main}
Legaulph (talk) 12:55, 20 March 2020 (UTC)
Karima Rafes (talkcontribs)
Legaulph (talkcontribs)
MediaWiki 1.31.1
PHP 7.1.30 (apache2handler)
MySQL 5.6.10
Semantic MediaWiki 2.5.8
CirrusSearch 0.2 (ad9a0d9) 16:24, 17 April 2018
Elastica 1.3.0.0 (7019d96) 20:49, 13 April 2018

This configuration was very different This was in the old configuration and it had fuseki instead of virtuoso. I added it below the example. still get the same error

"http://server.com": {
   "isReadOnly": true,
   "typeRDFDatabase": "virtuoso",
   "endpoint": "http://server.com/sparql",
   "HTTPMethodForRead": "GET"
}
Karima Rafes (talkcontribs)

Is it blocking? Otherwise the other features work?

Karima Rafes (talkcontribs)
Karima Rafes (talkcontribs)

I see the error : it's now endpointRead and not only endpoint.

Legaulph (talkcontribs)

Other features work, and the queries work other than the links are bad. Still get the error on the LinkedWiki configuration page.

SPARQL Flint editor gives the error: Classes cannot be retrieved. HTTP Status: 0,
SPARQL Editor seems fine
Karima Rafes (talkcontribs)

Ok thanks. I think :

- for the bad links, you need to check saved IRIs in your database (open the page http://server.com/sparql and test the SPARQL query "select distinct ?link where { ?link property:Has_subobject ?Subobject . }"). If your IRIs are false in your database, you have to change your settings of Mediawiki and/or SMW to generate the good links (and save/clean your database before each test).

- for Fint editor, you need to precise your endpoint manually (it's a old editor)

- for the LinkedWiki configuration page, it's a problem of version. You need to install Mediawiki 1.33.1+. The function addWikiTextAsInterface not exists before 1.32.

Legaulph (talkcontribs)

OK I needed to update enableSemantics( 'example.org/wiki/', true ); fixed most of the issues. why id the link "-" changed to "-2D"

exampl.org/wiki/Client_Firewall/TS-2DRoadmap the actual link shows like this now. https://exampl.org/wiki/Special:RunQuery/exampl.org/wiki/Client_Firewall/TS-2DRoadmap
I will check with Page Forms extension to see if they have suggestions.

Well I was running into a lot of issue trying to move to MediaWiki 1.34. I needed to move to a supported Semantic MediaWiki first before resolving those issues. Thanks for your help! Legaulph (talk) 12:56, 21 March 2020 (UTC)

Sorry Karima the question I have for you, even though it was the same in the old version.
Why do the links with a "-" changed to "-2D"? Legaulph (talk) 11:36, 23 March 2020 (UTC)
Karima Rafes (talkcontribs)

Give me a sample of triples and the code of the wiki page with this problem. I will try to reproduce/fix this problem at the next update.

Legaulph (talkcontribs)
when I run this on a wiki page I get the result with the -2D on the link column, I do see it is fine on other columns where there is a link
 {{#sparql:
 PREFIX property:<https://server.com/wiki/Property-3A>
 PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
 PREFIX swivt:<http://semantic-mediawiki.org/swivt/1.0#>
 SELECT ?supported_by ?Subcategory ?name ?version ?technology_name ?owner ?contact ?publication_date ?publication_status ?support_status ?Link
 WHERE 
 {
             ?Link property:Has_parent_page ?parent.
             ?parent property:PublicationStatus ?Publication_Status .
             ?Link property:Has_subobject ?Subobject .
             ?Subobject property:Technology_Name ?Name .
             ?Subobject property:Has_Start_Date ?Start_Date .
             OPTIONAL {
             ?Subobject property:Has_End_Date ?End_Date .
             }
             ?Subobject property:Has_Support_Status ?Status .
             OPTIONAL {
              ?parent ?p ?sub .
              ?cat rdfs:label ?Category .
              FILTER(CONTAINS(STR(?cat), "Category")) .
              ?sub rdfs:subClassOf ?cat .
              ?sub rdfs:label ?Subcategory .
             }
   ?subobject property:Has_Version ?version .
   ?subobject property:Technology_Name ?technology_name .
   ?subobject property:Has_Support_Status ?support_status .
   ?subobject property:Supported_By ?supported_by .
   ?subobject property:Has_Start_Date ?start_date .
 OPTIONAL {
   ?subobject property:Has_End_Date ?end_date .
 }
 OPTIONAL {
   ?parent property:OwnedBy ?owner.
 }
 OPTIONAL {
   ?parent property:PublicationDate ?publication_date .
   ?parent property:PublicationStatus ?publication_status .
 }
 OPTIONAL {
  ?parent ?p ?sub .
  ?cat rdfs:label ?Category .
  FILTER(CONTAINS(STR(?cat), "Category")) .
  ?sub rdfs:subClassOf ?cat .
  ?sub rdfs:label ?Subcategory .
 }
 OPTIONAL {
  ?parent property:ManufacturedBy ?manufacturer.
 }
 OPTIONAL {
  ?parent property:Contact ?contact.
 }
 }
 LIMIT 10
 |endpoint=http://server.com/sparql}}
Karima Rafes (talkcontribs)

And the sample of triples directly of your database ?

Karima Rafes (talkcontribs)
Legaulph (talkcontribs)
The same from the endpoint
 supported_by  Subcategory name  version technology_name owner contact publication_date  publication_status  support_status  Link
 "TS-Roadmap"
 "Technology Roadmap"
 "ENTERPRISE 47X110"
 "SAP R/3 ENTERPRISE 47X110"
 ""
 "DBServices@its.jnj.com"
 2014-03-14Z
 "Released"
 "Full"
 https://server.com/wiki/SQL_Server/TS-2DRoadmap
 "TS-Roadmap"
 "Technology Roadmap"
 "4.6C"
 "SAP R/3 4.6C"
 ""
 "DBServices@its.jnj.com"
 2014-03-14Z
 "Released"
 "Limited"
 https://server.com/wiki/SQL_Server/TS-2DRoadmap
 "TS-Roadmap"
 "Technology Roadmap"
 "4.0B"
 "SAP R/3 4.0B"
 ""
 "DBServices@its.jnj.com"
 2014-03-14Z
 "Released"
 "Limited"
 https://server.com/wiki/SQL_Server/TS-2DRoadmap
 "TS-Roadmap"
 "Technology Roadmap"
 "4.5B"
 "SAP R/3 4.5B"
 ""
 "DBServices@its.jnj.com"
 2014-03-14Z
 "Released"
 "Limited"
 https://server.com/wiki/SQL_Server/TS-2DRoadmap
 "TS-Roadmap"
 "Technology Roadmap"
 "4.0B"
 "SAP R/3 4.0B"
 ""
 "DBServices@its.jnj.com"
 2014-03-14Z
 "Released"
 "Full"
 https://server.com/wiki/SQL_Server/TS-2DRoadmap
 "TS-Roadmap"
 "Technology Roadmap"
 "4.5B"
 "SAP R/3 4.5B"
 ""
 "DBServices@its.jnj.com"
 2014-03-14Z
 "Released"
 "Full"
 https://server.com/wiki/SQL_Server/TS-2DRoadmap
 "TS-Roadmap"
 "Technology Roadmap"
 "4.6C"
 "SAP R/3 4.6C"
 ""
 "DBServices@its.jnj.com"
 2014-03-14Z
 "Released"
 "Full"
 https://server.com/wiki/SQL_Server/TS-2DRoadmap
Karima Rafes (talkcontribs)
Karima Rafes (talkcontribs)
Legaulph (talkcontribs)

Karima, Thank you, much appreciated. Legaulph (talk) 15:06, 23 March 2020 (UTC)

Karima Rafes (talkcontribs)

You're welcome. Bye.

Reply to "Query page using linked wiki"

popper.js not found after MW 1.35 upgrade

1
Summary by S0ring

By mistake didn't installed it with the composer/yarn

S0ring (talkcontribs)

The following error occured after upgrade to MW 1.35 (Linked 3.4.2), it seems popper.js is missing.


/linked/load.php?lang=en&modules=ext.LinkedWiki.SparqlParser%2Csgvizler2%7Cjquery%2Coojs-ui-core&skin=vector&version=1wkye RuntimeException from line 485 of /var/www/html/includes/resourceloader/ResourceLoaderFileModule.php: ResourceLoaderFileModule::getFileContents: script file not found, or is not a file: "/var/www/html/extensions/LinkedWiki/node_modules/popper.js/dist/umd/popper.min.js"

Backtrace:

#0 /var/www/html/includes/resourceloader/ResourceLoaderFileModule.php(905): ResourceLoaderFileModule->getFileContents(string, string)

#1 /var/www/html/includes/resourceloader/ResourceLoaderFileModule.php(362): ResourceLoaderFileModule->readScriptFiles(array)

#2 /var/www/html/includes/resourceloader/ResourceLoaderModule.php(736): ResourceLoaderFileModule->getScript(ResourceLoaderContext)

#3 /var/www/html/includes/resourceloader/ResourceLoaderModule.php(704): ResourceLoaderModule->buildContent(ResourceLoaderContext)

#4 /var/www/html/includes/resourceloader/ResourceLoader.php(1191): ResourceLoaderModule->getModuleContent(ResourceLoaderContext)

#5 /var/www/html/includes/resourceloader/ResourceLoader.php(899): ResourceLoader->makeModuleResponse(ResourceLoaderContext, array, array)

#6 /var/www/html/load.php(51): ResourceLoader->respond(ResourceLoaderContext)

#7 /var/www/html/load.php(38): wfLoadMain()

#8 {main}

Internal Error trying to delete a page

2
Legaulph (talkcontribs)
MediaWiki	1.31.7
PHP	7.3.19 (apache2handler)
MySQL	8.0.20
Elasticsearch	5.6.16
Semantic MediaWiki	3.1.6
LinkedWiki	3.4.0 (5601693) 07:10, 14 June 2020

[a0f68dd572e6f78708d8afea] /index.php?title=Encrypting_Databases_test&action=delete Error from line 84 of D:\Bitnami\wampstack\apps\mediawiki\extensions\LinkedWiki\LinkedWiki.php: Call to undefined method OutputPage::addWikiTextAsInterface() Backtrace:

  1. 0 D:\Bitnami\wampstack\apps\mediawiki\includes\Hooks.php(177): LinkedWiki::onArticleDeleteAfterSuccess(Title, OutputPage)
  2. 1 D:\Bitnami\wampstack\apps\mediawiki\includes\Hooks.php(205): Hooks::callHook(string, array, array, NULL)
  3. 2 D:\Bitnami\wampstack\apps\mediawiki\includes\page\Article.php(1871): Hooks::run(string, array)
  4. 3 D:\Bitnami\wampstack\apps\mediawiki\includes\page\Article.php(1618): Article->doDelete(string, boolean)
  5. 4 D:\Bitnami\wampstack\apps\mediawiki\includes\actions\DeleteAction.php(46): Article->delete()
  6. 5 D:\Bitnami\wampstack\apps\mediawiki\includes\MediaWiki.php(500): DeleteAction->show()
  7. 6 D:\Bitnami\wampstack\apps\mediawiki\includes\MediaWiki.php(294): MediaWiki->performAction(Article, Title)
  8. 7 D:\Bitnami\wampstack\apps\mediawiki\includes\MediaWiki.php(861): MediaWiki->performRequest()
  9. 8 D:\Bitnami\wampstack\apps\mediawiki\includes\MediaWiki.php(524): MediaWiki->main()
  10. 9 D:\Bitnami\wampstack\apps\mediawiki\index.php(42): MediaWiki->run()
  11. 10 {main}

Legaulph (talk) 16:26, 23 July 2020 (UTC)

Karima Rafes (talkcontribs)
Reply to "Internal Error trying to delete a page"

Fail to insert to SPARQL endpoint

8
ACastro24 (talkcontribs)

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 "";
    }

}
Karima Rafes (talkcontribs)
ACastro24 (talkcontribs)

Thank you Karima, That makes sense. I changed it, but I am still getting the same error message.


Here is the section of LocalSettings.php concerning LinkedWiki, as it stands:


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/beerwiki";


Karima Rafes (talkcontribs)

In the special page about the LinkedWiki configuration, all is ok ?

In the http errors, there is nothing ?

Karima Rafes (talkcontribs)

Try also without the parameter : "typeRDFDatabase" => "fuseki"

ACastro24 (talkcontribs)

Thank you Karima.

commenting <code>"typeRDFDatabase" => "fuseki"</code> did not change anything

The special page about the LinkedWiki configuration seems OK. Here is a screen capture of the config for that endpoint.

http://artserver.org/publicfiles/Screenshot_2020-05-18%20LinkedWiki%20configuration%20-%20beerwiki.png


This is the error I get:

Error endpoint: Error http_response_code: 0 Error message: Sorry, you have not configure the endpoint to update the database.

It does not seem to get any response from the SPARQL endpoint.

In Fuseki call the update POST also does not get acknowledged, which makes me think that the issue might be in how LinkedWiki is trying to "talk" to fuseki on update posts.

Is there a way I can debugg the POST calls that LinkedWiki is making to the SPARQL endpoint?


Karima Rafes (talkcontribs)
Karima Rafes (talkcontribs)

I pushed a new version. There are a bug in the special page RDFUnit and refresh database for the version 1.34.1. I don't know if your problem is related.

NB: You need to change a little your localsettings (new installation about PushAll and of NamespaceData)

Reply to "Fail to insert to SPARQL endpoint"
S0ring (talkcontribs)
Karima Rafes (talkcontribs)