Rob Syme
Rob Syme

Reputation: 362

Using page properties in a semantic mediawiki #ask query

What is the best way to construct an #ask query using semantic properties from the current page?

Let's say I have a page with the properties 'featurestart (has type::Number)', 'featurestop (has type::Number)' and 'srcfeature (has type::Page)'. Featurestart and featurestop are coordinates. I want to find the next query along the same srcfeature.

{{#ask:
[[featurestart::>{{#show: {{PAGENAME}} | ?featurestop}}]]
[[srcfeature::{{#show: {{PAGENAME}} | ?srcfeature}}]]
| limit=1
}}

The #ask query fails, giving the error:

The part "|Scaffold 16" of the query was not understood. Results might not be as expected.

Where 'Scaffold 16' is the value of the srcfeature property on the page I was testing. Note the extra "|" character.

The featurestart (a numeric property) works just fine. I suspect that problem is caused by the #show query returning not just the name of the property, but a formatted link.


Is there any way to either clean the return value of #show so that just the value is given? OR Is there a better way of retrieving properties for the current page so that they can be included in an #ask query?

Upvotes: 1

Views: 2095

Answers (1)

Rob Syme
Rob Syme

Reputation: 362

The problem is that the #show query here is returning a wiki link to the scaffold_16 page, rather than just the text.

The #ask query needs clean text, so the #show query needs to specify link=none:

[[srcfeature::{{#show: {{PAGENAME}} | link=none | ?srcfeature}}]]

Upvotes: 3

Related Questions