RDFIO icon indicating copy to clipboard operation
RDFIO copied to clipboard

Make it work on MW 1.34 + SMW 3.1.5

Open krabina opened this issue 6 years ago • 17 comments

Are there any plans to update this to make it work im MediaWiki 1.31 and SMW 3.x? Installation runs smooth, but

  • Setup at Special:RDFIO-Administration seems to work, but once you reload it, it says again, that the DB was not set up
  • every of the three special pages throw errors

krabina avatar Sep 11 '19 15:09 krabina

@krabina Ah, I thought we had it working with SMW 3.x, but either we missed something or perhaps something in later MW, has happened.

Hope to have a look soonish (not before Sep 17).

Many thanks for reporting!

samuell avatar Sep 14 '19 10:09 samuell

I'm on this now ...

samuell avatar Mar 18 '20 17:03 samuell

Seems a lot of the problems are caused because the db field of the ARC2Store object is now null when instantiating it. This is causing the isSetUp() to return false, and giving other problems, as it seems. Selection_0087

One problem is that reportedly ARC2 is now only tested with MariaDB, while I run MySQL (Trying to install MariaDB pretty much messed up a lot of my dpkg packages and installations).

samuell avatar Mar 19 '20 16:03 samuell

Hmm, did a little test script, which I document here for reference:

<?php

require "vendor/semsol/arc2/ARC2.php";

$store = ARC2::getStore(array(
    'db_name' => 'smw',
    'db_user' => 'smw',
    'db_pwd'  => '*******',
    'db_host' => '127.0.0.1',
    'cache_enabled' => true // <== activates cache
));

echo "<pre>";
print_r($store);
echo "</pre>";

It returns:

ARC2_Store Object
(
    [cache:protected] => 
    [db:protected] => 
    [db_object:protected] => 
    [a] => Array
        (
            [db_name] => smw
            [db_user] => smw
            [db_pwd] => *******
            [db_host] => 127.0.0.1
            [cache_enabled] => 1
        )
...

That [db:protected] seems like a hint ... something added layers of authentication in MySQL? Hints and tips are welcome.

samuell avatar Mar 19 '20 17:03 samuell

Ok, if I add one line, after creating the store:

$store->createDBCon();

... then I get in the Nginx log:

2020/03/19 18:41:35 [error] 892#892: *85 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Class 'ARC2\Store\Adapter\AbstractAdapter' not found in /var/www/html/w/vendor/semsol/arc2/src/ARC2/Store/Adapter/mysqliAdapter.php on line 17
PHP message: PHP Stack trace:
PHP message: PHP   1. {main}() /var/www/html/w/arc2test.php:0
PHP message: PHP   2. ARC2_Store->createDBCon() /var/www/html/w/arc2test.php:11
PHP message: PHP   3. ARC2\Store\Adapter\AdapterFactory->getInstanceFor() /var/www/html/w/vendor/semsol/arc2/store/ARC2_Store.php:88
PHP message: PHP   4. require_once() /var/www/html/w/vendor/semsol/arc2/src/ARC2/Store/Adapter/AdapterFactory.php:29" while reading response header from upstream, client: ::1, server: _, request: "GET /w/arc2test.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.2-fpm.sock:", host: "localhost"

Confusing, as I can't see anything wrong there. Digging on.

samuell avatar Mar 19 '20 17:03 samuell

I filed an issue over at the ARC2 repo, in case they have some hints: https://github.com/semsol/arc2/issues/140

samuell avatar Mar 19 '20 18:03 samuell

Can report that it works now, locally, with branch 59-make-work-with-mw-1.34.

Now just trying to be able to run the tests.

samuell avatar Mar 19 '20 22:03 samuell

One of the ARC2 maintainers here.

@samuell wrote:

One problem is that reportedly ARC2 is now only tested with MariaDB, while I run MySQL (Trying to install MariaDB pretty much messed up a lot of my dpkg packages and installations).

Thats not true. In our travis.yml you can find all configurations we test against. Short version is here: https://github.com/semsol/arc2#database-systems

Also:

Seems a lot of the problems are caused because the db field of the ARC2Store object is now null when instantiating it. This is causing the isSetUp() to return false, and giving other problems, as it seems.

I wrote the adapter layer for ARC2 to support PDO besides mysqli. ~~At that time i assumed no one used internal variables (asking in the issue tracker also revealed no one). If you do and can't not at the moment, please let me know and we can discuss it.~~

EDIT: I overlooked the isSetup part. That could be a mistake on our site. What was the old behavior?

k00ni avatar Mar 20 '20 08:03 k00ni

Hi @k00ni

One problem is that reportedly ARC2 is now only tested with MariaDB, while I run MySQL (Trying to install MariaDB pretty much messed up a lot of my dpkg packages and installations).

Thats not true. In our travis.yml you can find all configurations we test against. Short version is here: https://github.com/semsol/arc2#database-systems

Thanks for the clarification!

EDIT: I overlooked the isSetup part. That could be a mistake on our site. What was the old behavior?

The problem is solved now, in 06a151f. The fault is mine, I had missed this new part in the getting started guide, after the ARC2::getStore() line:

// since version 2.3+
$store->createDBCon();

I think I was a bit confused as the README.md is missing that part.

Maybe a note about that, for database backed stores, could be of use in the README.md?

samuell avatar Mar 20 '20 10:03 samuell

Current status:

  • [x] Make it stop throwing errors on all the special pages
  • [x] Make unit tests pass
  • [x] Make basic import work in the interface
  • [x] Ensure semantic data is populated, and available in SPARQL endpoint
  • [ ] Make "Output by Equivalent URI" work in web interface
  • [ ] Make "Query by Equivalent URI" work in web interface
  • [ ] Make roundtrip system test work

samuell avatar Mar 20 '20 23:03 samuell

Strange, now i get error:

Construct Template not found in ARC2_SPARQLPlusParser

... when trying to import the example turtle content. Didn't get it just before. Perhaps some caching problem that is adding extra confusion.

Checking in to https://github.com/semsol/arc2/issues/80

EDIT: Solved in a612852

samuell avatar Mar 28 '20 17:03 samuell

Latest status #63 :expressionless:

EDIT: Solved.

samuell avatar Mar 28 '20 20:03 samuell

For information, I was able to run this extension on MW 1.40.0-alpha + SMW master (post-4.0.2). It does not work out-of-the-box with the master branch, but it works with the branch 59-make-work-with-mw-1.34 or even better with the branch 59-make-work-with-mw-1.34 of simontaurus. Imho, this branch could be promoted as master, and it would fix #56, #59, #62.

However, this extension needs some maintenance. I began creating the extension.json file and will propose it soon as a PR.

Seb35 avatar Oct 05 '22 07:10 Seb35

As said, I did some maintenance work on this extension in addition of the branches mentionned above and it solves this issue (well, I guess it may remain some minor issues).

It is available on WikiValley’s fork together with the fork of ARC2.

Seb35 avatar May 22 '23 11:05 Seb35

As said, I did some maintenance work on this extension in addition of the branches mentionned above and it solves this issue (well, I guess it may remain some minor issues).

It is available on WikiValley’s fork together with the fork of ARC2.

@Seb35 That's fantastic! If you are able to package it up as a clean PR, I would be happy to have a look at merging it here as well!

samuell avatar May 23 '23 08:05 samuell

@Seb35 That's fantastic! If you are able to package it up as a clean PR, I would be happy to have a look at merging it here as well!

Great! :star_struck:

But it’s not as easy as a PR on this MediaWiki extension since I had to modify ARC2:

  • this commit and this one add a database adapter specifically for MediaWiki: nowadays MW has strict requirements about transactions and there were issues between queries from ARC2 and queries from MW itself (I didn’t search exactly why) => it can either be integrated this MW-specific adapter in ARC2, either be added a way to define custom adapters in ARC2
  • there were bugs is some SPARQL queries (mainly missing triples in the results), I modified ARC2 in 3 commits: first, second, third and there still some buggy SPARQL queries, so I’m not completely sure these patches are gold-quality

Seb35 avatar May 24 '23 18:05 Seb35

I've updated the extension page on MediaWiki.org to point to the WikiValley fork, since that seems preferable to pointing to an admittedly incompatible repository.

pppery avatar Sep 24 '23 03:09 pppery