GithubHelp home page GithubHelp logo

semanticmediawiki / semanticresultformats Goto Github PK

View Code? Open in Web Editor NEW
45.0 18.0 75.0 11.08 MB

Provides additional visualizations (result formats) for Semantic MediaWiki

Home Page: https://www.semantic-mediawiki.org/wiki/Extension:Semantic_Result_Formats

License: Other

PHP 7.56% CSS 3.42% JavaScript 87.23% HTML 0.10% Python 0.62% C 0.08% TypeScript 0.71% TeX 0.01% Less 0.18% Ruby 0.01% SCSS 0.08% Makefile 0.01%
mediawiki mw srf semantic semantic-mediawiki smw result-format

semanticresultformats's Introduction

Semantic Result Formats

CI Latest Stable Version Packagist download count

Semantic Result Formats (SRF) is a MediaWiki extension that provides extra visualizations (result formats) for Semantic MediaWiki queries. For more information, see the Semantic Result Formats documentation or consult the release notes.

Requirements

  • PHP 7.3.19 or later
  • MediaWiki 1.35 or later
  • Semantic MediaWiki 3.0 or later

Installation

The recommended way to install this extension is by using Composer. See the detailed installation guide which also contains information about compatibility and configuration.

Contribution and support

Semantic Result Formats is maintained by @JeroenDeDauw.

Chatroom Twitter Facebook LinkedIn YouTube Mailing lists

Primary support channels:

If you want to contribute work to the project please look at the contribution guildline. A list of people who have made contributions in the past can be found here.

Tests

This extension provides unit and integration tests and are normally run by a continues integration platform but can also be executed locally using the shortcut command composer phpunit from the extension base directory.

License

Generally published under GNU General Public License 2.0 or later together with third-party plugins and their license.

semanticresultformats's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

semanticresultformats's Issues

Graph format showing legend only if both graphcolor and graphlabel are set to "Yes"

From https://bugzilla.wikimedia.org/show_bug.cgi?id=36067 :

In SRF 1.7.1 when defining ask with parameter "format=graph", the graph legend is only shown when both parameters graphcolor and graphlabel are set to "Yes".
This is due to a logical "&&" in function getGVForDataValue of extensions/SemanticResultFormats/GraphViz/SRF_Graph.php:

 if ( $this->m_graphLabel && $this->m_graphColor ) {

In older version (1.5.2) there were a logical "||"

if ( ( $this->m_graphLabel == true ) || ( $this->m_graphColor == true ) ) {

Trying to use "||" instead of "&&" the graph legend is shown, so this may be a possible solution.

-- [email protected] 2012-04-18 14:40:32 UTC

New Graph result format

Posting an email from Kim Eik:

I'm trying to create a new Graph result format, where one could create a number of predefined graph types which all have slightly different input arguments.

So there would probably be a parameter which defines what graph it should use, and then after the graph has been determined. It should process the graphs own parameter definitions which is only used within that graph.

The mw code would look something along the lines of the following:

ask: [[Category:...]]

|?Property
|format=highcharts
|graph=frequency histogram
|bins=100 <--- graph parameter

As far as i understand each result format is a class which subclasses SemanticResultPrinter.

I've looked around in the code in SemanticResultPrinter to see if i can actually get the raw input arguments (unprocessed) however to no avail.

Which basically makes me think my approach impossible. The only other solution i could think of is to prefix all the graphs parameters with its own identifierm however this wouldn't be as elegant. But it would prevent parameter definition collisions.

An example could be:

ask: [[Category:...]]

|?Property
|format=highcharts
|graph=frequency histogram
|frequency histogram bins=100 <--- graph parameter

Would you happen to know a way around this? Or maybe have an idea for a better solution?

Thanks for your input.
-- Kim

Undefined index: named args in SRF_Timeline.php on line 39

MW 1.23.0rc0 (786ddd0), SMW 1.9.3 alpha (d99a162) , Semantic Result Formats 1.9.1 (23f9f39)

On some pages, and also during maintenance script SMW_refreshData.php, I'm getting the following error:

Notice: Undefined index: named args in
/home/lithics/domains/my_domain/mw-git/core/extensions/SemanticResultFormats/formats/timeline/SRF_Timeline.php
on line 39

Extract formats into their own packages?

Now that we have composer, would it make sense to maintain result formats separately and have SRF just pull them in?

One advantage would be, that it would make it possible to update SRF and keep selected formats at some lower version, e.g. to not have to update all the #asks in case some fundamental change took place for some format.

Another one would be that people could install just selected formats instead of the whole package (for that we would probably need some SRFBase package).

ListWidget: Does not display pages with numeric first character

Using the current git version of SRF, the listwidget seems to have a bug where it will not display pages with a numeric first character. The results are encoded in the HTML as

  • elements, but they don't appear to be tagged correctly and/or picked up or counted by the jquery code.

    You can see an example of this bug in action here:

    http://www.funtoo.org/Repository:Funtoo_LDAP_Overlay

    If you look at the HTML, you will see a number of results beginning with the number '3' that are not counted or displayable.

  • DataTables: Inline limit set to 750

    On the mailing-list the following appeared as question "s there a hard 750 on limit parameter for the amount of rows you can request in results format datatables?"

    I don't remember why the value was set to 750 but you could change it to something like:

    inlineLimit: smw.settings.get( 'smwgQMaxLimit' )
    

    slideshow format broken

    Hi.

    I've just upgraded a wiki to 1.23.7 from 1.19.5 and the slideshow format no longer works. I have:

    {{#ask:
    [[Category:Snippets]]
    [[Snippet Type::Did You Know]]
    | ?Headline
    | ?Description
    | order=random
    | format=slideshow
    | effect=none
    | delay=7
    | limit=15
    | width=210px
    | height=110px
    | mainlabel=-
    | template=Slide Format
    }}

    and nothing is displayed anymore. SMW is version 2 and SRF is version 2. All installed via Composer.

    Thanks.

    Disable Jenkins +2

    As uncovered by #4, WMF Jenkins is +2'ing changes after just running PHP lint, which causes broken code to be merged. Jenkins should not +2.

    DataTables: support "#" in printout statements and hide namespace prefixes

    Datatables is awesome, but it would be nice if it could support the same features of Broadtable like additional personalization of the values with "#" and hidden namespace prefixes.

    See:
    http://wikincat.org/wiki/User:Jaider/Página_de_testes
    and
    http://wikincat.org/wiki/User:Jaider/Página_de_testes?action=edit
    (same query, same printout statements, different result formats)

    Note the differences

    • in the values of the first and last columns
    • in the values in the "status" column
    • in the item column
    • in the date columns

    result format "gallery" does no longer play with "image_auth.php"

    After upgrading private wikis from SRF 1.8 to 2.0 the setting
    $wgUploadPath = "$wgScriptPath/img_auth.php";

    starts to prevent the files from being fetched due to a 403 permission error. So SRF does not longer seem to know what it is acting as a "logged in" user.

    MW 1.23 / Fatal error: Cannot access protected property ImageGallery::$mParser in Gallery.php on line 328

    Fatal error: Cannot access protected property ImageGallery::$mParser in ...\extensions\SemanticResultFormats\formats\gallery\Gallery.php on line 328

    Call Stack:
        0.0028     168800   1. {main}() ...\maintenance\runJobs.php:0
        0.0124     382416   2. require_once('...\maintenance\doMaintenance.php') C:\xampp\htdocs\mw\maintenance\runJobs.php:271
        0.4075    6684840   3. RunJobs->execute() ...\maintenance\doMaintenance.php:107
      427.3063   26540192   4. SMW\UpdateJob->run() ...\maintenance\runJobs.php:106
      427.3064   26539480   5. SMW\UpdateJob->runUpdate() ...\extensions\SemanticMediaWiki\includes\jobs\UpdateJob.php:52
      427.3095   26540192   6. SMW\UpdateJob->runContentParser() ...\extensions\SemanticMediaWiki\includes\jobs\UpdateJob.php:79
      427.3104   26549176   7. SMW\ContentParser->parse() ...\extensions\SemanticMediaWiki\includes\jobs\UpdateJob.php:102
      427.3105   26549208   8. SMW\ContentParser->fetchFromContent() ...\extensions\SemanticMediaWiki\includes\ContentParser.php:112
      427.3204   26554096   9. WikitextContent->getParserOutput() ...\extensions\SemanticMediaWiki\includes\ContentParser.php:155
      427.3219   26563416  10. Parser->parse() ...\includes\content\WikitextContent.php:319
      427.3230   26558952  11. Parser->internalParse() ...\includes\parser\Parser.php:395
      427.3231   26559608  12. Parser->replaceVariables() ...\includes\parser\Parser.php:1212
      427.3330   26560368  13. PPFrame_DOM->expand() ...\includes\parser\Parser.php:3147
      427.3349   26564784  14. Parser->braceSubstitution() ...\includes\parser\Preprocessor_DOM.php:1113
      427.3361   26566816  15. Parser->callParserFunction() ...\includes\parser\Parser.php:3330
      427.3418   26567864  16. call_user_func_array() ...\includes\parser\Parser.php:3613
      427.3419   26568440  17. SMW\Setup->SMW\{closure}() ...\includes\parser\Parser.php:3613
      427.3441   26571000  18. SMW\AskParserFunction->parse() ...\extensions\SemanticMediaWiki\includes\Setup.php:510
      427.3442   26571456  19. SMW\AskParserFunction->runQueryProcessor() ...\extensions\SemanticMediaWiki\includes\parserhooks\AskParserFunction.php:84
      427.4295   26447808  20. SMWQueryProcessor::getResultFromQuery() ...\extensions\SemanticMedaWiki\includes\parserhooks\AskParserFunction.php:130
      427.4393   26447880  21. SMW\ResultPrinter->getResult() ...\extensions\SemanticMediaWiki\includes\query\SMW_QueryProcessor.php:505
      427.4403   26449464  22. SRF\Gallery->buildResult() ...\extensions\SemanticMediaWiki\includes\queryprinters\ResultPrinter.php:209
      427.4403   26449464  23. SRF\Gallery->getResultText() ...\extensions\SemanticResultFormats\formats\gallery\Gallery.php:67
      427.4413   26458208  24. SRF\Gallery->addImagePages() ...\extensions\SemanticResultFormats\formats\gallery\Gallery.php:160
      427.4509   26464448  25. SRF\Gallery->addImageToGallery() ...\extensions\SemanticResultFormats\formats\gallery\Gallery.php:298
    

    Datatables: URL type destroys complete table

    This issue occurs in Datatables format: As soon as I add a property to a query from type URL, the table is not displayed at all (the loading icon just appears).

    Example:

    |?my_link=Link

    Property definition of my_link:

    This is a property of type [[Has type::URL]].

    My system (even though the issue occured also in earlier versions):

    • MW 1.24.1
    • SMW: 2.1
    • SRF: 2.1.1
    • SF: 3.0
    • SFI: 0.9.0

    icalendar should escape text values

    The icalendar format support the use of custom event summaries, descriptions, and locations taken from SMW property values. These texts are inserted into the file without any escaping. Of course this breaks the file as soon as the text values contain any symbol that has a special meaning in icalendar, notably line breaks, commas, and semicolons. The escaping mechanism of RFC 2445 must be applied to prevent this.

    Process / Unexpected non-MediaWiki exception encountered, of type "Exception"

    The exception at the bottom is thrown when the example in-line query from https://semantic-mediawiki.org/wiki/Help:Process_format is rendered in SMW 1.22.2, SRF 1.9.2 alpha. Presumably this is because I haven't created any of the properties (or Category:Process Step) it is querying.

    Here is the query:

    {{#ask: [[Category:Process Step]] [[Category:{{PAGENAME}}]]
    | ?has OrSuccessor=hasorsuccessor
    | ?has Successor=hassuccessor
    | ?has ConTrueSuccessor=hascontruesuccessor
    | ?has ConFalseSuccessor =hasconfalsesuccessor
    | ?has Condition=hascondition
    | ?has Role=hasrole
    | ?uses Resource=usesresource
    | ?has Status=hasstatus
    | format=process
    | graphsize=12,12
    | graphvalidation=no
    | showroles=yes
    | showstatus=yes
    | showresources=yes
    | clustercolor=lightgrey
    }}

    Here is the exception:

    Unexpected non-MediaWiki exception encountered, of type "Exception"
    [e2c6a3b4] /w/index.php?title=GraphViz&action=submit Exception from line 201 of /home/welterkj/public_html/mediawiki/w/vendor/param-processor/param-processor/src/ParamProcessor/ParamDefinitionFactory.php: Could not construct a ParamDefinition from an array without message element
    Backtrace:
    #0 /home/welterkj/public_html/mediawiki/w/vendor/param-processor/param-processor/src/ParamProcessor/ParamDefinition.php(595): ParamProcessor\ParamDefinitionFactory->newDefinitionFromArray(array)
    #1 /home/welterkj/public_html/mediawiki/w/vendor/param-processor/param-processor/src/ParamProcessor/ParamDefinition.php(534): ParamProcessor\ParamDefinition::getCleanDefinitions(array)
    #2 /home/welterkj/public_html/mediawiki/w/vendor/param-processor/param-processor/src/ParamProcessor/Param.php(224): ParamProcessor\ParamDefinition->format(ParamProcessor\Param, array, array)
    #3 /home/welterkj/public_html/mediawiki/w/vendor/param-processor/param-processor/src/ParamProcessor/Processor.php(369): ParamProcessor\Param->process(array, array, ParamProcessor\Options)
    #4 /home/welterkj/public_html/mediawiki/w/vendor/param-processor/param-processor/src/ParamProcessor/Processor.php(290): ParamProcessor\Processor->doParamProcessing()
    #5 /home/welterkj/public_html/mediawiki/w/extensions/SemanticMediaWiki/includes/query/SMW_QueryProcessor.php(48): ParamProcessor\Processor->processParameters()
    #6 /home/welterkj/public_html/mediawiki/w/extensions/SemanticMediaWiki/includes/query/SMW_QueryProcessor.php(417): SMWQueryProcessor::getProcessedParams(array, array)
    #7 /home/welterkj/public_html/mediawiki/w/extensions/SemanticMediaWiki/includes/parserhooks/AskParserFunction.php(123): SMWQueryProcessor::getQueryAndParamsFromFunctionParams(array, integer, integer, boolean)
    #8 /home/welterkj/public_html/mediawiki/w/extensions/SemanticMediaWiki/includes/parserhooks/AskParserFunction.php(84): SMW\AskParserFunction->runQueryProcessor(array)
    #9 /home/welterkj/public_html/mediawiki/w/extensions/SemanticMediaWiki/includes/Setup.php(504): SMW\AskParserFunction->parse(array)
    #10 [internal function]: SMW{closure}(Parser, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string, string)
    #11 /home/welterkj/public_html/mediawiki/w/includes/parser/Parser.php(3615): call_user_func_array(Closure, array)
    #12 /home/welterkj/public_html/mediawiki/w/includes/parser/Parser.php(3332): Parser->callParserFunction(PPFrame_DOM, string, array)
    #13 /home/welterkj/public_html/mediawiki/w/includes/parser/Preprocessor_DOM.php(1114): Parser->braceSubstitution(array, PPFrame_DOM)
    #14 /home/welterkj/public_html/mediawiki/w/includes/parser/Parser.php(3149): PPFrame_DOM->expand(PPNode_DOM, integer)
    #15 /home/welterkj/public_html/mediawiki/w/includes/parser/Parser.php(1212): Parser->replaceVariables(string)
    #16 /home/welterkj/public_html/mediawiki/w/includes/parser/Parser.php(395): Parser->internalParse(string)
    #17 /home/welterkj/public_html/mediawiki/w/includes/content/WikitextContent.php(300): Parser->parse(string, Title, ParserOptions, boolean, boolean, NULL)
    #18 /home/welterkj/public_html/mediawiki/w/includes/EditPage.php(3223): WikitextContent->getParserOutput(Title, NULL, ParserOptions)
    #19 /home/welterkj/public_html/mediawiki/w/includes/EditPage.php(2169): EditPage->getPreviewText()
    #20 /home/welterkj/public_html/mediawiki/w/includes/EditPage.php(441): EditPage->showEditForm()
    #21 /home/welterkj/public_html/mediawiki/w/includes/actions/EditAction.php(50): EditPage->edit()
    #22 /home/welterkj/public_html/mediawiki/w/includes/actions/EditAction.php(76): EditAction->show()
    #23 /home/welterkj/public_html/mediawiki/w/includes/Wiki.php(448): SubmitAction->show()
    #24 /home/welterkj/public_html/mediawiki/w/includes/Wiki.php(312): MediaWiki->performAction(Article, Title)
    #25 /home/welterkj/public_html/mediawiki/w/includes/Wiki.php(602): MediaWiki->performRequest()
    #26 /home/welterkj/public_html/mediawiki/w/includes/Wiki.php(467): MediaWiki->main()
    #27 /home/welterkj/public_html/mediawiki/w/index.php(49): MediaWiki->run()
    #28 {main}

    Process: Broken with GraphViz 1.3.1

    The process format does not work at all using MW 1.23.2 with extensions SMW 2.0, SRF 2.0 and GraphViz 1.3.1.

    1. Using the Process format results in debug message 'The SRF Graph printer needs the GraphViz extension to be installed.' This is due the "renderGraphviz" method does not work (any more) - line 204:

    if ( !is_callable( 'renderGraphviz' ) )

    1. I changed the method call from renderGraphviz to GraphViz::graphvizParserHook, that is used within the graph format. Well, at least an image with the process diagram is created now. But it isn't displayed on the page, it's just created in the wiki image namespace. And, even worse: Each time the page with the embedded ask query is accessed, a new image is created.

    So, it seems that this process format is outdated and does not work with the recent GraphViz extension. Would be great to fix this and maybe also to improve the documentation about this format.

    See my example: https://www.kruedewagen.de/wiki/Process1

    srfgScriptPath for formats/calendar/SRF_Calendar.php

    'href' => $GLOBALS['srfgScriptPath'] . '/formats/calendar/resources/ext.srf.calendar.css'
    I am not quite sure whether I own fix would fit the standards of the extension:
    'href' => $GLOBALS['wgScriptPath'] . '/extensions/SemanticResultFormats/formats/calendar/resources/ext.srf.calendar.css'

    That is why I post this issue. The calendar throws an error and even though the variable appears to be declared in the SemanticResultsFormat.php (line 37), I am unable to access the proper css file; which makes the calender thing pretts much useless.

    Next release

    Let's go with 2.0 together with SMW, so SRF is also semver compliant?

    Fatal error using gallery on MediaWiki 1.23.0rc0

    I just upgraded my farm to 1.23.0rc0 and the gallery format now throws a fatal PHP error:

    PHP message: PHP Fatal error: Cannot access protected property ImageGallery::$mParser in .../w/extensions/SemanticResultFormats/formats/gallery/Gallery.php on line 310

    Datatables: Date has a 1-day difference when client is in another timezone

    We have a SMW + SRF wiki which runs in CET timezone (set in Linux OS, PHP and wiki). We have a semantic property from type "Date". When setting this property to a value like "2014/03/19" (either in source code, by using SF or with datepicker), the datatables format shows "19 March 2014" when I view the table in my clients timezone, which is also CET. So far, so good.

    But: We have users in timezone EST. When they view the result of the inline query as "datatables" format, they see a date of "18 March 2014". So, there is a gap of one day. When switching to e.g. "broadtable", the date is ok with "19 March 2014".

    So, this is definitively a "datatables" problem, maybe as a combination of timezones set on server/client. I don't know yet.

    When I change my timezone in the wiki preferences to EST or even GMT-08, the resulting "datatable" output is ok with "19 March 2014".

    However, the EST-user checked it on another local EST-client. The 1-day difference could be reproduced there.

    I don't know how to "simulate" this problem on my side. I always see the right date in the output. I don't have a public wiki in place to show the issue, but could setup something if needed.

    Is there anything I could check or set regarding Manual:Timezone?

    Datatables with Foreground Skin: Rendering of the search button and pagination is buggy

    Hello,

    I got some problems using the extension in my mediawiki environment. I am using Foreground as skin and I am trying to display some data with the datatables from the extension. As you can see in the screenshot the search button on the top right and the pagination on the buttom are not displayed correctly. Do you have any idea how to solve this problem?

    example

    Versions:
    MediaWiki 1.24.1
    Semantic MediaWiki 2.1
    Semantic Result Formats 2.0
    Foreground 1.2-alpha (7d098d2)

    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.