I want to create a two way relationship between test cases and requirements in MediaWiki using Semantic MediaWiki. Specifically, I have test cases which include this property:
This test covers requirements [[RequirementID::Requirement 12345]], [[RequirementID::Requirement 54321]].
Then I have a query like this:
{{#ask:format="table"|[[Category:Test case] |?RequirementID}}
This enables me to list all the test cases and their matching requirements, a one to many relationship in a table. E.g.
- test case 1 covers requirements 12345, 54321
- test case 2 covers requirements 12323, 22340
- etc
Now what I want is also to show the mapping from requirements to test cases (so the opposite relationship), e.g.
- requirement 12345 is tested by test cases 1, 2 and 3.
I'm trying to solve it using compound queries like this:
{{#compound_query:[[Category:Requirement]];?Description || [[Category:Test design]]; |format=table}}
or this, which works but I want the page title, not the Description
{{#ask:format="table"|[[Category:Requirement]] |?Description}}
But this just lists all requirements and all test cases. Anyone know how to solve this?
I have MediaWiki 1.17.0 and Semantic Bundle Version 2011-08-24.20110824.
Update: I think there may be a way to do it using something like this:
{{#ask:format="table"|[[Category:Requirement]]|?[[Special:WhatLinksHere/::{{SUBJECTPAGENAME}}]]}}
That is, using WhatLinksHere to get all the test case pages from the Requirements category. But I cannot get the syntax right.