Reputation: 877
(I'm kind of new to the whole Semantic Mediawiki thing and have been scouring the web for some leads on this small project I'm doing. )
How do I go about defining properties that are derived from other properties in a Semantic Mediawiki. Assuming I have created course with SMW and would to provide details on the progress of the course (i.e. the current page / total number of pages in %).
I read there is this Semantic Extra Special Properties extension where an extra SUBPAGES property exist. Would it help? I'm guessing I could go about with #ask
or some sorts and check on what subpage I am of the whole course?
Any further (better) ideas?
Upvotes: 0
Views: 751
Reputation: 81
You can define a Semantic Property using an #ask
query. Here is an example in one of my wikis doing just what you described, showing a count and then a percentage of the total population. In this case I'm defining two variables first just to make the code more readable and since I need the website_count
value twice I avoid a 2nd query.
{{
#vardefine: website_extension |
{{#ask: [[Has extension::{{FULLPAGENAME}}]] | format=count }}
}}{{
#vardefine: website_count |
{{#ask: [[Category:Website]] [[Is validated::True]] [[Is active::True]] [[Collect extension data::True]] | format=count }}
}}
[[Has website count::{{#var:website_extension}}]] ([[Has website percent::{{#expr: ( ( {{#var: website_extension}} / {{#var: website_count}} ) * 100 ) round2 }}]]%)
Subobjects and the Semantic Extra Special Properties are not needed for any of this.
Upvotes: 0