问题描述
我最近安装了MediaWiki扩展名语义MediaWiki.在此扩展中,您可以定义属性.它们就像价值的类别.如果我这样定义两个属性:
I installed the MediaWiki-extension Semantic MediaWiki recently. In this extension you can define properties. They are like categories for values. If I define two properties like this:
[[StartYear :: 2000]] [[EndYear :: 2005]]
[[StartYear::2000]] [[EndYear::2005]]
如果进行语义搜索,是否可以基于这些属性进行计算.例如:
Is it possible to make calculations based on these properties if I do a semantic search. For example:
{{## ask:[[Category:Project]] [[EndYear]]-[[StartYear]] = 5}}
{{#ask: [[Category:Project]] [[EndYear]] - [[StartYear]] = 5}}
获得所有为期5年的项目吗?
to get all projects with a duration of 5 years?
最好,UP
推荐答案
为此,您需要预处理每个项目页面的间隔.
For this you would need to pre-process the interval for each project page.
如果您使用的是模板,则可以使用以下代码轻松创建模板:
If you are using a template, you can easily create do it with the following code:
[[Interval::{{#expr:{{{StartYear}}} - {{{EndYear}}}}}| ]]
然后您可以通过以下方式查询它:
Then you can query it this way:
{{#ask: [[Category:Project]] [[Interval::5]]}}
这篇关于语义mediawiki属性计算的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!