문제

How would I go about to list any duplicate values for a property in Semantic MediaWiki? A MySQL query would do fine, it doesn't have to be through a SMW query.

도움이 되었습니까?

해결책

I found a way that works for me:

With Extension:Variables installed, create a template {{Detect duplicates}} like this:

{{#ifeq:{{#var:a}}|{{#vardefineecho:a|{{{2|}}}}}|<!--

    Found a duplicate! Print some message:

-->Duplicate found: {{{2}}}<!--

    Not a duplicate, do nothing

-->|}}

and ask for values like this:

{{#ask:[[MyProperty::+]]
 |?MyProperty
 |sort=MyProperty
 |format=template
 |template=Detect duplicates
}}

It is important to sort the results before sending them to the template, as the duplicate has to come next to each others.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top