GithubHelp home page GithubHelp logo

Comments (5)

thomas-topway-it avatar thomas-topway-it commented on August 16, 2024

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 SMW\SPARQLStore, not SMW\SQLStore. On the other side, a class SMW\SPARQLStore\QueryEngineFactory does not exist.
So first I would need to know whether search panes queries are applicable to the SPARQLStore and they should be implemented for it. If so, we have to look at the class SMW\SPARQLStore\SPARQLStoreFactory (function newMasterQueryEngine), where there is some hint. Otherwise we could just use your workaround to provide an empty result.

from semanticresultformats.

simontaurus avatar simontaurus commented on August 16, 2024

Thank you for your response. Correct, I'm using a SPARQLStore.
The missing SMW\SPARQLStore\QueryEngineFactory was also comming up while I was browsing the SMW sources.
Apparently the issue only occurs with |sort=SomePropertyOfTypeDateTime while saving the page edits or purging the page, in all other cases (also normal reloads) everything including the search panels looks fine.
Since |sort=SomePropertyOfTypeDateTime works in principle with other result formats I hope there's a solution.

from semanticresultformats.

thomas-topway-it avatar thomas-topway-it commented on August 16, 2024

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 ?

from semanticresultformats.

simontaurus avatar simontaurus commented on August 16, 2024

One option would be our docker image / compose-stack

from semanticresultformats.

simontaurus avatar simontaurus commented on August 16, 2024

After doing some research on that I still do not understand in which cases SMW passes an SPARQLStore as store and in which cases a SQLStore - it seems random. Maybe @JeroenDeDauw / @kghbln can elaborate on that.

While ElasticStore subclasses SQLStore
https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/c8f778a85aca38d4d78173c4014f9dc40d067473/src/Elastic/ElasticStore.php#L39

SPARQLStore has a private member that is a SQLStore
https://github.com/SemanticMediaWiki/SemanticMediaWiki/blob/c8f778a85aca38d4d78173c4014f9dc40d067473/src/SPARQLStore/SPARQLStore.php#L49-L66

So theoretically using this basestore should work, but any try to provide a SQLStore as fallback fails, see below.

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)

Error 1050: Table 't3' already exists
Function: SMW\SQLStore\TableBuilder\TemporaryTableBuilder::create
Query: CREATE TEMPORARY TABLE `t3`( id INT UNSIGNED KEY ) ENGINE=MEMORY

Backtrace:

from /var/www/html/w/includes/libs/rdbms/database/Database.php(1618)
#0 /var/www/html/w/includes/libs/rdbms/database/Database.php(1602): Wikimedia\Rdbms\Database->getQueryException()
#1 /var/www/html/w/includes/libs/rdbms/database/Database.php(1576): Wikimedia\Rdbms\Database->getQueryExceptionAndLog()
#2 /var/www/html/w/includes/libs/rdbms/database/Database.php(952): Wikimedia\Rdbms\Database->reportQueryError()
#3 /var/www/html/w/includes/libs/rdbms/database/DBConnRef.php(103): Wikimedia\Rdbms\Database->query()
#4 /var/www/html/w/includes/libs/rdbms/database/DBConnRef.php(293): Wikimedia\Rdbms\DBConnRef->__call()
#5 /var/www/html/w/extensions/SemanticMediaWiki/src/MediaWiki/Connection/Database.php(380): Wikimedia\Rdbms\DBConnRef->query()
#6 /var/www/html/w/extensions/SemanticMediaWiki/src/MediaWiki/Connection/Database.php(292): SMW\MediaWiki\Connection\Database->executeQuery()
#7 /var/www/html/w/extensions/SemanticMediaWiki/src/SQLStore/TableBuilder/TemporaryTableBuilder.php(59): SMW\MediaWiki\Connection\Database->query()
#8 /var/www/html/w/extensions/SemanticMediaWiki/src/SQLStore/QueryEngine/HierarchyTempTableBuilder.php(111): SMW\SQLStore\TableBuilder\TemporaryTableBuilder->create()
#9 /var/www/html/w/extensions/SemanticMediaWiki/src/SQLStore/QueryEngine/QuerySegmentListProcessor.php(355): SMW\SQLStore\QueryEngine\HierarchyTempTableBuilder->fillTempTable()
#10 /var/www/html/w/extensions/SemanticMediaWiki/src/SQLStore/QueryEngine/QuerySegmentListProcessor.php(132): SMW\SQLStore\QueryEngine\QuerySegmentListProcessor->hierarchy()
#11 /var/www/html/w/extensions/SemanticMediaWiki/src/SQLStore/QueryEngine/QuerySegmentListProcessor.php(146): SMW\SQLStore\QueryEngine\QuerySegmentListProcessor->segment()
#12 /var/www/html/w/extensions/SemanticMediaWiki/src/SQLStore/QueryEngine/QuerySegmentListProcessor.php(122): SMW\SQLStore\QueryEngine\QuerySegmentListProcessor->table()
#13 /var/www/html/w/extensions/SemanticMediaWiki/src/SQLStore/QueryEngine/QuerySegmentListProcessor.php(220): SMW\SQLStore\QueryEngine\QuerySegmentListProcessor->segment()
#14 /var/www/html/w/extensions/SemanticMediaWiki/src/SQLStore/QueryEngine/QuerySegmentListProcessor.php(125): SMW\SQLStore\QueryEngine\QuerySegmentListProcessor->conjunction()
#15 /var/www/html/w/extensions/SemanticMediaWiki/src/SQLStore/QueryEngine/QuerySegmentListProcessor.php(146): SMW\SQLStore\QueryEngine\QuerySegmentListProcessor->segment()
#16 /var/www/html/w/extensions/SemanticMediaWiki/src/SQLStore/QueryEngine/QuerySegmentListProcessor.php(122): SMW\SQLStore\QueryEngine\QuerySegmentListProcessor->table()
#17 /var/www/html/w/extensions/SemanticMediaWiki/src/SQLStore/QueryEngine/QuerySegmentListProcessor.php(115): SMW\SQLStore\QueryEngine\QuerySegmentListProcessor->segment()
#18 /var/www/html/w/extensions/SemanticResultFormats/formats/datatables/SearchPanes.php(153): SMW\SQLStore\QueryEngine\QuerySegmentListProcessor->process()
#19 /var/www/html/w/extensions/SemanticResultFormats/formats/datatables/SearchPanes.php(85): SRF\DataTables\SearchPanes->getPanesOptions()
#20 /var/www/html/w/extensions/SemanticResultFormats/formats/datatables/DataTables.php(586): SRF\DataTables\SearchPanes->getSearchPanes()
#21 /var/www/html/w/extensions/SemanticResultFormats/formats/datatables/DataTables.php(440): SRF\DataTables->getResultText()
#22 /var/www/html/w/extensions/SemanticMediaWiki/src/Query/ResultPrinters/ResultPrinter.php(304): SRF\DataTables->buildResult()
#23 /var/www/html/w/extensions/SemanticMediaWiki/includes/query/SMW_QueryProcessor.php(348): SMW\Query\ResultPrinters\ResultPrinter->getResult()
#24 /var/www/html/w/extensions/SemanticMediaWiki/src/ParserFunctions/AskParserFunction.php(370): SMWQueryProcessor::getResultFromQuery()
#25 /var/www/html/w/extensions/SemanticMediaWiki/src/ParserFunctions/AskParserFunction.php(202): SMW\ParserFunctions\AskParserFunction->doFetchResultsFromFunctionParameters()
#26 /var/www/html/w/extensions/SemanticMediaWiki/src/ParserFunctionFactory.php(402): SMW\ParserFunctions\AskParserFunction->parse()
#27 /var/www/html/w/includes/parser/Parser.php(3437): SMW\ParserFunctionFactory->SMW\{closure}()
#28 /var/www/html/w/includes/parser/Parser.php(3122): Parser->callParserFunction()
#29 /var/www/html/w/includes/parser/PPFrame_Hash.php(275): Parser->braceSubstitution()
#30 /var/www/html/w/includes/parser/Parser.php(2951): PPFrame_Hash->expand()
#31 /var/www/html/w/includes/parser/Parser.php(1609): Parser->replaceVariables()
#32 /var/www/html/w/includes/parser/Parser.php(723): Parser->internalParse()
#33 /var/www/html/w/includes/content/WikitextContentHandler.php(301): Parser->parse()
#34 /var/www/html/w/includes/content/ContentHandler.php(1721): WikitextContentHandler->fillParserOutput()
#35 /var/www/html/w/includes/content/Renderer/ContentRenderer.php(47): ContentHandler->getParserOutput()
#36 /var/www/html/w/includes/Revision/RenderedRevision.php(266): MediaWiki\Content\Renderer\ContentRenderer->getParserOutput()
#37 /var/www/html/w/includes/Revision/RenderedRevision.php(237): MediaWiki\Revision\RenderedRevision->getSlotParserOutputUncached()
#38 /var/www/html/w/includes/Revision/RevisionRenderer.php(221): MediaWiki\Revision\RenderedRevision->getSlotParserOutput()
#39 /var/www/html/w/includes/Revision/RevisionRenderer.php(158): MediaWiki\Revision\RevisionRenderer->combineSlotOutput()
#40 [internal function]: MediaWiki\Revision\RevisionRenderer->MediaWiki\Revision\{closure}()
#41 /var/www/html/w/includes/Revision/RenderedRevision.php(199): call_user_func()
#42 /var/www/html/w/includes/poolcounter/PoolWorkArticleView.php(91): MediaWiki\Revision\RenderedRevision->getRevisionParserOutput()
#43 /var/www/html/w/includes/poolcounter/PoolWorkArticleViewCurrent.php(97): PoolWorkArticleView->renderRevision()
#44 /var/www/html/w/includes/poolcounter/PoolCounterWork.php(162): PoolWorkArticleViewCurrent->doWork()
#45 /var/www/html/w/includes/page/ParserOutputAccess.php(299): PoolCounterWork->execute()
#46 /var/www/html/w/includes/page/Article.php(714): MediaWiki\Page\ParserOutputAccess->getParserOutput()
#47 /var/www/html/w/includes/page/Article.php(528): Article->generateContentOutput()
#48 /var/www/html/w/includes/actions/ViewAction.php(78): Article->view()
#49 /var/www/html/w/includes/MediaWiki.php(542): ViewAction->show()
#50 /var/www/html/w/includes/MediaWiki.php(322): MediaWiki->performAction()
#51 /var/www/html/w/includes/MediaWiki.php(904): MediaWiki->performRequest()
#52 /var/www/html/w/includes/MediaWiki.php(562): MediaWiki->main()
#53 /var/www/html/w/index.php(50): MediaWiki->run()
#54 /var/www/html/w/index.php(46): wfIndexMain()
#55 {main}

from semanticresultformats.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.