2

I have a scientific paper collection stored in semantic mediawiki. The page is always the title of the paper. Every paper has a unique id in the form of the citekey property [[Has citekey::someauthor2019]].

Now, I want to link it to other publications and automatically show a table of all referenced papers. In order to do that I keep multiple properties per page with a reference property [[Has reference::authorX2017]], [[Has reference::authorY2018]], etc.

To achieve that I want to get all references with an #ask query and use these results in a new #ask query to get all results that have either of the references as their citekey property.

To acquire the references I use a combination of this #ask query:

{{#ask: [[Has citekey::someauthor2019]]
 |?Has reference
 |format=template
 |template=Query Result
}}

with this Query Result format Template:

{{{2}}}

For example, this would lead to the output: authorX2017, authorY2018

How can I use this automatically in a new #ask query to obtain a list of the pages that have any of these references as their citekey property?

Thank you for any advise!

Wald3n
  • 133
  • 1
  • 10

1 Answers1

1

How can I use this in a new #ask query to obtain a list of the pages that have any of these references as their citekey property?

You should just use the result parameter as a new parameter of the inner ask query inside your template. Any trouble this way ?

Try to use

 |link=none

(see source 1)

this will pass {{{1}}} and {{{2}}} results as raw text to your template

You request becomes :

{{#ask: [[Has citekey::someauthor2019]]
 |?Has reference
 |format=template
 |template=Query Result
 |link=none
}}

Then you can use {{{1}}} and {{{2}}} as parameters for a new query.

But, you said that you may have multiple results for the {{{has reference}}} result parameter. So you should use something like an arraymaptemplate (see source 2).

{{#arraymaptemplate:value|template|delimiter|new_delimiter}}

where 'template' will use each value of the {{{2}}} list in its own request.

Sources :

  1. https://www.semantic-mediawiki.org/wiki/Help:Inline_queries#Standard_parameters_for_inline_queries

  2. https://www.mediawiki.org/wiki/Extension:Page_Forms/Page_Forms_and_templates#arraymaptemplate

Camille
  • 151
  • 5
  • Thank you. That is what I plan to do. However, I would like to pass the result automatically to a new query and I cannot figure out how to pass the result of one query to the input of the new query, especially when I have multiple results of my query for references. – Wald3n Oct 11 '19 at 12:11
  • should not be an issue, use 1 2 3 as param name for each of your result values (if you have 3 values return for each result) – Camille Nov 24 '22 at 05:26