bwanders / dokuwiki-strata

Strata - a Semi-Structured Data plugin for Dokuwiki
https://www.dokuwiki.org/plugin:strata
17 stars 8 forks source link

Table gives correct result only when predicate not correctly written #48

Closed pop-ch closed 4 years ago

pop-ch commented 4 years ago

Dokuwiki Release rc-2020-06-09 "Hogfather" RC3

I am trying to define a table which shows a hierarchy of projects. In English terms the query is to show all projects which are not parts of other projects, and their sub-projects. The predicate which associates a subproject with its main project is partof: The table yields the proper result if and only if the two occurrences of the predicate partof: are written differently: "partof:" and "Partof:" are OK, two times "partof:" is not OK. The attached sample shows two variants of the query. I found out by pure chance that the two occurrences of the predicate had to use different spellings. -------------Sample page (all in one page)---------------- <data proj #main1> name: main 1 partof[page]:

<data proj #main2> name: main 2 partof[page]:

<data proj #sub1> name: sub 1 partof[page]: #main1

<data proj #sub2> name: sub 2 partof[page]: #main1

===Correct output=== <table ?project ?part> ?project is a: proj optional { ?part partof: ?project } minus { --- note the incorrect capitalisation of the predicate partof: --- in the following line ?project Partof: ?higher } group { ?project }

===Incorrect output===

<table ?project ?part> ?project is a: proj optional { ?part partof: ?project } minus { --- In the following line the predicate is correctly capitalised ?project partof: ?higher } group { ?project } Attachment: Dokuwiki page rendered as PDF (if I succeed in attaching such a thing) correct_output.pdf

bwanders commented 4 years ago

That is a very interesting case you discovered. Thanks for reporting it, and especially for the succinct example!

I'll look into it over the next week, time permitting.

(PS. Here on github you can use markdown's triple backtick code block notation to make code samples retain their formatting:

Like so.
Even if they have newlines,
    or indents.

For me it works best to write out my whole comment, then use the Preview feature to check which notation I need to fix before commenting.)

pop-ch commented 4 years ago

Thank you very much for your hint on formatting code examples. I'm new here and can use any number of hints, I'm afraid. And thank you in advance for looking into this issue.

Salient features of this case appear to be that the query uses two different instances of the same class, and each instance uses the same predicate, but for different purposes. I suspect that using different variants of the predicate forces strata to perform the query for the field twice instead of caching the result for both uses.

bwanders commented 4 years ago

Fixed!

pop-ch commented 4 years ago

Thank you very much. That fixed it.