Skip to content

[datatables] SearchPanes do not handle inverse properties correctly #920

@simontaurus

Description

@simontaurus

A query with inverse properties

{{#ask: ...
|?-SomeProperty
|format=datatable
|datatables-searchPanes=true
}}

leads to an exception because -SomeProperty is used to lookup the property in

$property = new DIProperty( DIProperty::newFromUserLabel( $printRequest->getCanonicalLabel() ) );

Exception caught: Illegal property key "-HasCreationContext".","data":{"errorclass":"SMW\\Exception\\PropertyLabelNotResolvedException"}}],"trace":"SMW\\Exception\\PropertyLabelNotResolvedException at /var/www/html/w/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_Property.php(94)
from /var/www/html/w/extensions/SemanticMediaWiki/includes/dataitems/SMW_DI_Property.php(94)
#0 /var/www/html/w/extensions/SemanticResultFormats/formats/datatables/SearchPanes.php(139): SMW\\DIProperty->__construct()
#1 /var/www/html/w/extensions/SemanticResultFormats/formats/datatables/SearchPanes.php(73): SRF\\DataTables\\SearchPanes->getPanesOptions()
#2 /var/www/html/w/extensions/SemanticResultFormats/formats/datatables/DataTables.php(614): SRF\\DataTables\\SearchPanes->getSearchPanes()
#3 /var/www/html/w/extensions/SemanticResultFormats/formats/datatables/DataTables.php(432): SRF\\DataTables->getResultText()
#4 /var/www/html/w/extensions/SemanticMediaWiki/src/Query/ResultPrinters/ResultPrinter.php(302): SRF\\DataTables->buildResult()
#5 /var/www/html/w/extensions/SemanticMediaWiki/includes/query/SMW_QueryProcessor.php(344): SMW\\Query\\ResultPrinters\\ResultPrinter->getResult()
#6 /var/www/html/w/extensions/SemanticMediaWiki/src/ParserFunctions/AskParserFunction.php(367): SMWQueryProcessor::getResultFromQuery()
#7 /var/www/html/w/extensions/SemanticMediaWiki/src/ParserFunctions/AskParserFunction.php(201): SMW\\ParserFunctions\\AskParserFunction->doFetchResultsFromFunctionParameters()
#8 /var/www/html/w/extensions/SemanticMediaWiki/src/ParserFunctionFactory.php(392): SMW\\ParserFunctions\\AskParserFunction->parse()
#9 /var/www/html/w/includes/parser/Parser.php(3437): SMW\\ParserFunctionFactory->SMW\\{closure}()
#10 /var/www/html/w/includes/parser/Parser.php(3122): Parser->callParserFunction()
#11 /var/www/html/w/includes/parser/PPFrame_Hash.php(275): Parser->braceSubstitution()
#12 /var/www/html/w/includes/parser/Parser.php(2951): PPFrame_Hash->expand()
#13 /var/www/html/w/includes/parser/Parser.php(1609): Parser->replaceVariables()
#14 /var/www/html/w/includes/parser/Parser.php(723): Parser->internalParse()
#15 /var/www/html/w/includes/content/WikitextContentHandler.php(301): Parser->parse()
#16 /var/www/html/w/includes/content/ContentHandler.php(1721): WikitextContentHandler->fillParserOutput()
#17 /var/www/html/w/includes/content/Renderer/ContentRenderer.php(47): ContentHandler->getParserOutput()
#18 /var/www/html/w/includes/Revision/RenderedRevision.php(266): MediaWiki\\Content\\Renderer\\ContentRenderer->getParserOutput()
#19 /var/www/html/w/includes/Revision/RenderedRevision.php(237): MediaWiki\\Revision\\RenderedRevision->getSlotParserOutputUncached()
#20 /var/www/html/w/includes/Revision/RevisionRenderer.php(236): MediaWiki\\Revision\\RenderedRevision->getSlotParserOutput()
#21 /var/www/html/w/includes/Revision/RevisionRenderer.php(158): MediaWiki\\Revision\\RevisionRenderer->combineSlotOutput()
#22 [internal function]: MediaWiki\\Revision\\RevisionRenderer->MediaWiki\\Revision\\{closure}()
#23 /var/www/html/w/includes/Revision/RenderedRevision.php(199): call_user_func()
#24 /var/www/html/w/extensions/TemplateData/includes/Hooks.php(99): MediaWiki\\Revision\\RenderedRevision->getRevisionParserOutput()
#25 /var/www/html/w/includes/HookContainer/HookContainer.php(338): MediaWiki\\Extension\\TemplateData\\Hooks::onMultiContentSave()
#26 /var/www/html/w/includes/HookContainer/HookContainer.php(137): MediaWiki\\HookContainer\\HookContainer->callLegacyHook()
#27 /var/www/html/w/includes/HookContainer/HookRunner.php(2614): MediaWiki\\HookContainer\\HookContainer->run()
#28 /var/www/html/w/includes/Storage/PageUpdater.php(901): MediaWiki\\HookContainer\\HookRunner->onMultiContentSave()
#29 /var/www/html/w/includes/EditPage.php(2597): MediaWiki\\Storage\\PageUpdater->saveRevision()
#30 /var/www/html/w/includes/EditPage.php(1905): EditPage->internalAttemptSave()
#31 /var/www/html/w/includes/api/ApiEditPage.php(518): EditPage->attemptSave()
#32 /var/www/html/w/includes/api/ApiMain.php(1900): ApiEditPage->execute()
#33 /var/www/html/w/includes/api/ApiMain.php(844): ApiMain->executeAction()
#34 /var/www/html/w/extensions/VisualEditor/includes/ApiVisualEditorEdit.php(141): ApiMain->execute()
#35 /var/www/html/w/extensions/VisualEditor/includes/ApiVisualEditorEdit.php(459): MediaWiki\\Extension\\VisualEditor\\ApiVisualEditorEdit->saveWikitext()
#36 /var/www/html/w/includes/api/ApiMain.php(1900): MediaWiki\\Extension\\VisualEditor\\ApiVisualEditorEdit->execute()
#37 /var/www/html/w/includes/api/ApiMain.php(875): ApiMain->executeAction()
#38 /var/www/html/w/includes/api/ApiMain.php(846): ApiMain->executeActionWithErrorHandling()
#39 /var/www/html/w/api.php(90): ApiMain->execute()
#40 /var/www/html/w/api.php(45): wfApiMain()
#41 {main}"}

A fix is to strip the leading '-'. There also an option $inverse in newFromUserLabel() but it seems not to have any effect
https://doc.semantic-mediawiki.org/classSMW_1_1DIProperty.html#af275603e960b153df62b5051e20282fc

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions