在语义 mediawiki #ask 查询中使用页面属性
使用当前页面的语义属性构建 #ask 查询的最佳方法是什么?
假设我有一个具有属性“featurestart (has type::Number)”、“featurestop (has type::Number)”和“srcfeature (has type::Page)”的页面。 featurestart 和featurestop 是坐标。我想沿着相同的 srcfeature 找到下一个查询。
{{#ask:
[[featurestart::>{{#show: {{PAGENAME}} | ?featurestop}}]]
[[srcfeature::{{#show: {{PAGENAME}} | ?srcfeature}}]]
| limit=1
}}
#ask 查询失败,给出错误:
查询的“|Scaffold 16”部分无法理解。结果可能 没有达到预期。
其中“Scaffold 16”是我正在测试的页面上的 srcfeature 属性的值。注意额外的“|”特点。
featurestart(一个数字属性)工作得很好。我怀疑该问题是由 #show 查询不仅返回属性名称,还返回格式化链接引起的。
有没有什么方法可以清理 #show 的返回值,以便只给出该值? 或者 是否有更好的方法来检索当前页面的属性,以便将它们包含在 #ask 查询中?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题是这里的#show查询返回的是scaffold_16页面的wiki链接,而不仅仅是文本。
#ask 查询需要纯文本,因此 #show 查询需要指定 link=none:
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: