This Forum has been archived

Forums: Admin Central Index Technical Help Getting a report of all SMW properties linked to a page
Central's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.
Note: This topic has been unedited for 1602 days. It is considered archived - the discussion is over. Do not add to unless it really needs a response.

Semantic MediaWiki question this time out. We use SMW at w:c:tardis to help us control the mind-numbing number of crew members we catalogue. Because Doctor Who has been running for 50 years, there's plenty of movement in the crew — camera operators become cinematographers, floor managers become directors, etc. But it's almost impossible for anyone to know every position that every crew member has ever held. So what I'm wondering is how to write an SMW statement that will print out a list of all SMW properties linked to a page — without having to specify all the applicable property names. In other words, I'm looking for a statement with the functionality of "WhatPropertiesLinksHere". Any guesses how to achieve this? czechout@fandom    fly tardis 14:56: Tue 18 Sep 2012

What you want is a query for one value over all properties in the wiki. And then display the properties instead of the value…
I reckon, the most you can get is Special:WhatLinksHere with namespace set to Property. Sounds like a DPL thing.--PedroM (talk) 23:13, September 18, 2012 (UTC)
Is that what I want? I'm not sure that it is. I ultimately want the values, too. What I'm really trying to do is create a simple, un-parametered template that people can just plop down on a page and it will then list all the jobs that a person has ever had. Currently what I have is the simple one-job template called tardis:template:pcred. This allows me to specify the job and I'll get a list. For instance, if I type {{pcred|director}}, it'll show me every episode on which the PAGENAME was credited as a director. And that's fine and all, but what I need is something where I can just type {{pcred}}, and it'll give me every job they ever had and every episode on which they had a particular credit.
I know it can't be a DPL thing, because DPL doesn't create a relational database so much as it manipulates categories. This is about answering the fairly sophisticated question, "Given the list of properties on this wiki, what are the ones in which PAGENAME is a value, and which other pages share the value of PAGENAME in that property?" czechout@fandom    fly tardis 03:03: Wed 19 Sep 2012
To clarify: In your first post you said "without having to specify the applicable property names", but in the second one you say "given the list of properties on this wiki". Do you have a list of all jobs on doctor who? If there were say, ten, could you not just have a template something like (I dunno the specifics of the code)
===As director===
===As writer===
===As producer===
Because presumably if they haven't worked as a certain job, pcred will just return an empty string?--Category:Acer4666 10:22, September 19, 2012 (UTC)
I ultimately want the values, too. - No you don't. On your wiki, people are only stored as SMW property values. So you already know the value, but want every property (name) that somewhere on the wiki is set to this one value. You probably mean to say you want the pages where a property is set to it as well.--PedroM (talk) 13:51, September 19, 2012 (UTC)
Maybe smw:Help:Selecting pages#Subqueries for properties can help you in your task.--PedroM (talk) 14:14, September 19, 2012 (UTC)
To answer Acer's question first, yeah, I have a list of all the jobs. It's basically, but not quite, the same thing as the list of all properties on the wiki. So it's about 200 titles (and growing, because they keep adding job titles). If I did your little series of #ifs, for that many possibilities, would it become an impractically expensive template? I know that #switches with hundreds of different options are frowned upon, so would hundreds of different #ifs be similarly expensive? czechout@fandom    fly tardis 02:19: Thu 20 Sep 2012
I don't think SMW is designed for what you're talking about - normally the values of properties aren't shared between different properties. If you wanted to do what you're talking about, I think on the episode pages you would have to set it up like
[[Russell T Davies]] was the [[Russell T Davies::Writer]] of this episode
[[Steven Spielberg]] was the [[Steven Spielberg::Director]] of this episode
ie, make the people the properties and their jobs the values, then you could go to [[Property:Russel T Davies]] and you'd have a list of what episodes he worked on and his job on each one. But then you couldn't do the inverse, ie get up a list of directors and what episodes they worked on--Category:Acer4666 15:19, September 20, 2012 (UTC)