Search code examples
mediawikisemantic-mediawiki

Combine different properties into one colum in #ask query in semantic mediawiki


Is it possible to combine two properties with the same datatype into one column in an #ask query in SMW?

Suppose I have different datasets with Identifiers that are named differently:

#Object1
[[Has isbn::9780552145985]]

#Object2
[[Has id=83897239]]

I would like to combine these two in one column in an #ask query, like this:

{{#ask:
 [[Category:Besitz]]
 |?Has id = ID
 |?Has ISBN = ID
 |format=broadtable
}}

In the result I would like to have only the one column ID instead of two columns that are called ID.

Thank you in advance!


Solution

  • Use template format instead of broadtable with template like

    {{!}}-
    {{!}} {{{Has isbn|{{{Has id|}}}}}}
    

    Or install Semantic Scribunto, use mw.smw.ask and row['Has id'] or row['Has isbn'].