在语义 mediawiki #ask 查询中使用页面属性

发布于 2025-01-01 18:23:23 字数 754 浏览 3 评论 0原文

使用当前页面的语义属性构建 #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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

锦爱 2025-01-08 18:23:23

问题是这里的#show查询返回的是scaffold_16页面的wiki链接,而不仅仅是文本。

#ask 查询需要纯文本,因此 #show 查询需要指定 link=none

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

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}}]]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文