-
-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[datatables] ($store) must be of type SMW\SQLStore\SQLStore, SMW\SPARQLStore\SPARQLStore given #827
Comments
Hello @simontaurus as far as I understand you are using as SPARQLStore, is that correct ? I haven't tested it directly, however I think that QueryEngineFactory (for it to work) should be a subclass of |
Thank you for your response. Correct, I'm using a SPARQLStore. |
hello @simontaurus I've checked but I need to test with a SPARQLStore and I don't have it installed right now. Is there any docker container that I can use for this purpose ? |
One option would be our docker image / compose-stack |
After doing some research on that I still do not understand in which cases SMW passes an While
So theoretically using this basestore should work, but any try to provide a public function getSearchPanes( $printRequests, $searchPanesOptions ) {
if ( !( $this->datatables->store instanceof \SMW\SQLStore\SQLStore ) ) { // we got a SPARQLStore
// $this->datatables->store = new SQLStore(); // fails, see exception
// $this->datatables->store = \SMW\Services\ServicesFactory::getInstance()->getStore(); // fails, see exception
// $this->datatables->store = \SMW\StoreFactory::getStore( "\SMW\SQLStore\SQLStore" ); // fails, see exception
// $this->datatables->store = $this->datatables->store->baseStore; // fails, private property 'baseStore'
$closure = \Closure::bind(function &(\SMW\SPARQLStore\SPARQLStore $class) { // dirty hack to access private member
return $class->baseStore;
}, null, \SMW\SPARQLStore\SPARQLStore::class);
$this->datatables->store = &$closure($this->datatables->store); // fails, see exception
}
} Exception (may indicate a dirty state on the DB due to a previous exception while playing around with some dirty hacks)
|
@thomas-topway-it, @JeroenDeDauw public function getSearchPanes( $printRequests, $searchPanesOptions ) {
if ( this->datatables->store instanceof \SMW\SPARQLStore\SPARQLStore ) ) { // we got a SPARQLStore
$closure = \Closure::bind(function &(\SMW\SPARQLStore\SPARQLStore $class) { // dirty hack to access private member
return $class->baseStore;
}, null, \SMW\SPARQLStore\SPARQLStore::class);
$this->datatables->store = &$closure($this->datatables->store); // works
}
} We can get rid of the closure if we make SPARQLStore->baseStore public |
in order to allow result format to access the SQLStore since SPARQLStore is not a subclass of SQLStore (different from ElasticStore). See: SemanticMediaWiki#5748 SemanticMediaWiki/SemanticResultFormats#827
* make $baseStore public in order to allow result format to access the SQLStore since SPARQLStore is not a subclass of SQLStore (different from ElasticStore). See: #5748 SemanticMediaWiki/SemanticResultFormats#827 * Update SPARQLStore.php --------- Co-authored-by: Jeroen De Dauw <[email protected]>
@simontaurus It seems a great solution, so the standard Regarding the unrelated error
it could be fixed setting to an higher value than 0. However in a similar case the error showed up anyway, I need to reproduce it to figure out the root cause |
Correct. After doing so, panels work as expected with a SPARQLStore
Currently I patch with fix: create temp table only of not existing yet, see https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/5714
sed -i -e 's/"CREATE TEMPORARY TABLE "/"CREATE TEMPORARY TABLE IF NOT EXISTS "/g' $MW_HOME/extensions/SemanticMediaWiki/src/SQLStore/TableBuilder/TemporaryTableBuilder.php Great! This solved the issue Fixes merged here OpenSemanticLab:SemanticResultFormats:dev resolved all my issues =). |
@simontaurus I'm not sure to what the statement "Great! This solved the issue" is addressed here ? the IF NOT EXISTS clause or something else ? Is it related to this ? #860 |
sorry, this was indeed a copy past error from my answer to #860 |
Setup
Issue
(@thomas-topway-it)
Sporadically pages with a datatables query throw the mentioned error, probably when a purge is executed but it's hard to reproduce
The corresponding line is now in:
SemanticResultFormats/formats/datatables/SearchPanes.php
Line 51 in 6dd7e46
Not sure in which cases QueryResult->getStore() returns
SMW\SPARQLStore\SPARQLStore
in a SPARQLStore setup.SemanticResultFormats/formats/datatables/DataTables.php
Line 510 in 6dd7e46
Workaround is to catch cases where
SMW\SPARQLStore\SPARQLStore
is givenSteps to reproduce
Expected result: No exception
Observed result: exception occurs:
The text was updated successfully, but these errors were encountered: