3

I'm trying to created a template that will output a dynamic report by generating a list of pages with Dynamic Page List and then run queries on each page using Semantic Mediawiki, outputting the whole mess in a table. The structure of the template looks like this:

{| class="wikitable sortable collapsible collapsed" width="100%"
|- valign="bottom"
! width="15%" | Compound ID
! width="15%" | Generic name
! width="15%" | Trade name
! width="15%" | Developer
! width="10%" | Phase of development
! width="30%" | Target
{{#dpl:
 | category=compounds
 | linksto={{PAGENAME}}{{#dpl: linksto={{PAGENAME}} | redirects=only | mode=userformat | format=,{{!}},%TITLE%, | suppresserrors=true }}
 | ignorecase=true
 | distinct=strict
 | format=,{{!}}- valign="top"\n{{indication-based compound list/row|%TITLE%}}\n
 | noresultsheader={{!}}-\n{{!}} colspan="6" align="center" {{!}} ''No compounds have yet been studied for this indication.''
}}
|}

{{indication-based compound list/row}} consists of the following:

<includeonly>{{!}} {{#show: {{{1}}} | ?compound id }}
{{!}}{{!}} {{#show: {{{1}}} | ?compound generic name }}
{{!}}{{!}} {{#show: {{{1}}} | ?compound trade name }}
{{!}}{{!}} {{#show: {{{1}}} | ?developer }}
{{!}}{{!}} {{#ask: [[category:clinical studies]][[compound number::{{{1|}}}]] | ?Study phase=| limit=1| mainlabel=-| searchlabel=| sort=Study phase| order=descending }}
{{!}}{{!}} {{#show: {{{1|}}} | ?target }}</includeonly>

The {{#ask}} query is the reason why this isn't just a straight-forward DPL table: because the current phase of clinical development of a specific compound for a specific indication is a dynamic piece of data that changes frequently, the only option seems to be using an {{#ask}} query to find out the highest value for study phase among the clinical trials that meet the parameters. But this template will be surveying auto-generated pages and I don't have a way of auto-loading a list of indications for each compound (to apply semantic markup to), so instead it's generating based on lists of indication links that are themselves generated by a {{#dpl}} function on each compound page.

I've walked through this step by step, and none of the following are the problem:

  1. The template code is sound, and generates the proper structure.
  2. The table row template is sound, and if I remove the {{#dpl}} function and replace it with the template and a compound page name as a parameter, e.g. {{indication-based compound list/row|infliximab}}, it creates exactly the output I'm looking for.
  3. The {{#dpl}} function produces the correct list of pages when using the default output format.
  4. The {{#dpl}} function passes the list as sequential parameters properly when using format = ,{{template}} with a simply dummy template (just an unordered list).

However, when I put all the pieces together I just get empty table cells. The {{#show}} and {{#ask}} functions can't seem to accept the DPL input as parameters. Is there an additional argument or intermediate step I'm skipping that can sanitize the input and make the whole thing work? Or are DPL and SMW fundamentally incompatible in this way?

  • DynamicPageList 2.01
  • Semantic MediaWiki 1.8
  • MediaWiki 1.20.2
  • PHP 5.3.19 (apache2handler)
  • MySQL 5.1.30
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129

1 Answers1

2

Looks like the problem is that Semantic Mediawiki can't parse the PAGE% and %TITLE% variables generated by Dynamic Page List when you use the format argument, and there's no way around that since DPL doesn't render those into real data until the function is completed.