Help talk:Inline queries

Jump to: navigation, search
Please note

Talk pages on this wiki should primarily be used to address possible mistakes as well as missing and superseded information in the documentation.
In case you are seeking support concerning individual questions, please have a look at this page.
The SMW user mailing list is always a good idea for seeking help.

Please note

Please, have a look at the archive discussions as well.

Header name for inverse properties in ask queries

If I display the value of an inverse property as in {{#ask: [[...]] | format=table | ... | ?-Property name=Header name}}, the table fails to display the specified header in the table. The header is blank while regular property value headers are shown as given. Note that the values of the inverse property are all shown and are correct. It is only the column header that is not shown.

Is this a bug?

Note that the workaround is to use format=template and construct the table myself. I use the intro template to name the headers correctly, and user {{#show:}} to get the properties I want in the individuals rows. However, I see no reason why format=table should fail to display the given header name.

Cheifgeek157 (talk)17:31, 13 November 2015

link=subject - what is it supposed to do ?

If link is set to subject, what is the wiki supposed to do? I don't get it....

Heinrich krebs (talk)00:55, 22 September 2015

Good question. Never used this.

[[kgh]] (talk)16:23, 22 September 2015

Examples/Different link parameter options should clarify the intention and usage.

MWJames (talk)17:04, 22 September 2015

Hey, great! Thanks for this one!

[[kgh]] (talk)20:02, 22 September 2015

Query for Pages with subobjects


I have a page with the following wiki-code which I fill with a semantic form:

|Name=ZI Test 01
|Bezeichnung=Task 01
|Anmerkungen=Test 2
|TeilProjekt=EDV-Projekte/ZI TEST 01
|Bezeichnung=Task 02
|Status=im Plan
|Anmerkungen=Test 3
|TeilProjekt=EDV-Projekte/ZI TEST 01
|Bezeichnung=Test 3
|Status=im Verzug
|Anmerkungen=Was kostet das ganze denn in €?
|TeilProjekt=EDV-Projekte/ZI TEST 01

To make a #ask query for the subojects ist no problem. Now I also want to make query for the main object {{EDV-Projekte...

My query looks like this:

[[Hat Abfrage::+]]

But I only receive the pagename and no vaklues for the fields. Does anyone has idea what went wrong or how I have to define the query?

Thank you in advance


MichaelZ70 (talk)14:11, 17 March 2015
Edited by author.
Last edit: 09:28, 18 March 2015

Could you explain what you're trying to do? Why are you using "Has query" / "Hat Abrage" for this?

Cavila (talk)16:06, 17 March 2015
Edited by author.
Last edit: 09:59, 18 March 2015

I want to have a table with all the values from the first part not from the parts with {{#subobject:

I tried also
{{#ask: [[Category:EDV-Projekte]]
... (all pages are in this Category) but with the same result. The result table looks like this:
Name Ziel Kat Aufwand Team Prio IstM IstY Kom Status
EDV-Projekte/ZI Test 01
EDV-Projekte/ZI Test 02
MichaelZ70 (talk)08:41, 18 March 2015

OK, so the first part is a template (Vorlage:EDV-Projekte) that adds property values directly to the page. Maybe there's something wrong with your template. Could you check with 'Attribute anzeigen' to see if the values are correctly stored at all?

Cavila (talk)09:28, 18 March 2015

No! The properties are not show on the page Special:Properties. Only the properties from the subobject part. my form looks like this:

{{{for template|EDV-Projekte}}}
{| class="formtable"
! Projektname:
| colspan="2"|{{{field|Name|mandatory}}}
! Ziel:
| colspan="2"|{{{field|Ziel|mandatory|input type=textarea}}}
! Kategorie:
| colspan="2"|{{{field|Kat|mandatory|input type=combobox|autocomplete|values=B2B,Controlling,DMS-Windream,Informationsplattform,IT-Infrastruktur,Organisation,Reporting,SANGROSS,Schulung,Sonstiges, Support}}}
! Aufwand:
| colspan="2"|{{{field|Aufwand}}}
! Team:
| colspan="2"|{{{field|Team|input type=combobox|autocomplete|size=20|values=BUC-ZIM,BUC-SCM,SCM-ZIM,HOK-SCM}}}
! Priorität:
| colspan="2"|{{{field|Prio|input type=combobox|autocomplete|size=6|values=1,2,3,4,X}}}
! Zieltermin - Plan:
| width="100px"|{{{field|PlanM|input type=combobox|autocomplete|size=10|values=Jan,Feb,Mär,Apr,Mai,Jun,Jul,Aug,Sep,Okt,Nov,Dez}}}
|{{{field|PlanY|input type=combobox|autocomplete|size=12|values=2012,2013,2014,2015,2016,2017,2018,2019,2020}}}
! Zieltermin - aktuell:
| width="100px"|{{{field|IstM|input type=combobox|autocomplete|size=10|values=Jan,Feb,Mär,Apr,Mai,Jun,Jul,Aug,Sep,Okt,Nov,Dez}}}
|{{{field|IstY|input type=combobox|autocomplete|size=12|values=2012,2013,2014,2015,2016,2017,2018,2019,2020}}}
! Kommentar:
| colspan="2"|{{{field|Kom|input type=textarea}}}
! Status:
| colspan="2"|{{{field|Status|mandatory|input type=combobox|autocomplete|values=unbearbeitet,im Plan,im Verzug,neuer Termin,zurückgestellt,abgeschlossen}}}
! Anmerkungen:
| colspan="2"|{{{field|Anm|input type=textarea}}}
{{{end template}}}

{{{for template|#subobject:|label=Teilprojekte / Aufgaben|multiple}}}
|{{{field|Bearbeiter|input type=combobox|autocomplete|size=6|values=CB,KH,MS,MZ}}}
|{{{field|Datum|input type=datepicker|date}}}
! '''Status:'''
| {{{field|Status|input type=combobox|autocomplete|values=unbearbeitet,im Plan,im Verzug,neuer Termin,zurückgestellt,abgeschlossen}}}
! '''Fällig bis:'''
| {{{field|FaelligBis|input type=datepicker|date}}}
|{{{field|Anmerkungen|input type=textarea}}}{{{field|TeilProjekt|hidden|default={{PAGENAME}} }}}
{{{end template}}}

{{{standard input|save}}} {{{standard input|preview}}} {{{standard input|changes}}} {{{standard input|cancel}}}

and the template like this:

 |width="50px"|'''Projektname:'''||<span style="font-size:x-large; text-shadow:grey 3px 2px 4px; color:darkblue;">'''{{{Name|}}}'''</span>
 |Zieltermin - Plan:||{{{PlanM|}}} {{{PlanY|}}}
 |Zieltermin - aktuell:||{{{IstM|}}} {{{IstY|}}}

[[Image:Part01.png|25 px|link=]] <big>'''Teilprojekte / Aufgaben:'''</big>

{{#ask: [[-Has subobject::{{PAGENAME}}]] 
| mainlabel=-
| ?Bezeichnung
| ?Bearbeiter
| ?Datum
| ?Status
| ?FaelligBis = Fällig bis
| ?Anmerkungen
| index=0
| link=subject
| headers=show
| format=datatable
| class=sortable wikitable smwtable
| default=keine Teilprojekte / Aufgaben gefunden

MichaelZ70 (talk)09:39, 18 March 2015

To judge by your template, you haven't provided any semantic properties for those values so it is only to be expected that there are no semantic annotations. In your template, you could add a 'silent' form of annotation to your template, such as


(etcetera .. you could fill in the rest)

For our user manual on creating semantic content, see Help:Editing.

Unusually enough, it looks like you also have a template named after the subobject parser, or perhaps there is no template at all and the form adds subobjects directly. I'm surprised that it works, but this isn't exactly the recommended way to go about.

All of this suggests as though you are confusing MW's templates and SMW's syntax functions. Are you aware of the differences?

Cavila (talk)10:48, 18 March 2015

Templates with paramaters as an "introtemplate"

A thread, Thread:Help talk:Inline queries/Templates with paramaters as an "introtemplate", was moved from here to Help talk:Template format. This move was made by Kghbln (Talk | contribs) on 27 August 2014 at 07:35.

Using template with paramaters as an introtemplate

A thread, Thread:Help talk:Inline queries/using template with paramaters as an introtemplate, was moved from here to Help talk:Template format. This move was made by Kghbln (Talk | contribs) on 27 August 2014 at 07:34.

How Can I Make a table using two different categories?

I wanna make a table, but the data I need belongs to two different categories, How can I put the inline query?

Juan Cristobal Viscarra (talk)08:42, 9 May 2014

Sounds like this is what you are looking for: {{#ask: [[Category:CatOneName||CatTwoName]] ...

More info: Help:Selecting_pages#Unions_of_query_results:_disjunctions

Eric (talk)14:47, 9 May 2014

Yeah!! Thank you very much Eric

Juan Cristobal Viscarra (talk)07:15, 15 May 2014

CSV Export with a large number of fields

Hi, I have a mediawiki page and wish to add a #ask query with a large number of fields (110) and export the data to CSV file. This doesnt work and it gives me a 404 file not found error. when i reduce the number of fields in the query, it works. Please help.

Cmm9888 (talk)10:20, 18 March 2014

Probably you have reached the $smwgQPrintoutLimit. I case of such big queries it might be a good idea to just split it up and merge the result after export.

[[kgh]] (talk)18:14, 18 March 2014

Thanks for that very prompt reply. Could you please tell me as to what options do i have about splitting it up and merging it. i mean is this possible using the #ask query? Say i have 1000 results, how do i get the first 500 and then the next 500? Thank you very much once again..

Cmm9888 (talk)08:09, 19 March 2014

It seems that I have misunderstood your question. In case you have a lot of result sets $smwgQMaxInlineLimit needs to be adjusted.

[[kgh]] (talk)15:42, 19 March 2014

Results of a query are not parsed as wikitext

I have a query that I want to use to create a dymanic list of properties but the output of the query is not rendered.

{{#ask: [[Category:Weblogic Application]] [[Installed Instance::Ms1]] | format=template | template=Installed_Applications }}

Where the Installed_Applications template is this:

* Installed Application: [[Installed Application::{{{1}}}]]

The output ends up looking like unrendered wiki text:

    Installed Application: [[Installed Application::Calendar-public-web]] 
    Installed Application: [[Installed Application::Ceii-public-web]] 
    Installed Application: [[Installed Application::Fivemin]] 
    Installed Application: [[Installed Application::Forecast]] 

Is there a way to make this dymanic list of properties render into the properties?

Thanks, Pete.

Hepaestus (talk)14:22, 24 February 2014

Add link=none to your query.

Alexander Mashintalk02:43, 25 February 2014

All-in-one table and export link?

Is there any way to have the same #ask query generate both the table and also include (somewhere) an export link that runs the same query for export?

I would like to create pages that both display the data as a table and also provide the export link with a single query. To do so currently, I'm having to basically include the same #ask query twice, where one query is slightly different in that it specifies that it's an export link.

Lsilverman (talk)21:22, 14 January 2014

This it is not possible though it would indeed be a nice feature in some cases.

[[kgh]] (talk)13:43, 15 January 2014

Is having two {{#ask:}}'s really a problem here? After all, the second one should not query anything, it's just a link to a query that will be executed only if clicked.

Alex Mashintalk02:38, 16 January 2014

Wikitext not working inside property displayed with show only on one page of the wiki

This is one of the pages of the wiki where it works:

It doesn't work only on this page:

The script on the both of the pages is:

  • {{#show:{{BASEPAGENAME}} | format = template | template = ==|?Surl= }} {{#show:{{BASEPAGENAME}} | ?Surl= }}
Natbrown (talk)10:03, 8 July 2013

What are these faces ( ͡° ͜ʖ ͡°) for?

Yury Katkov (talk)05:52, 19 July 2013
( ͡° ͜ʖ ͡°) for the students
Natbrown (talk)21:03, 19 July 2013

I have deleted the pages now, and we are running SMW_refreshData.php

Natbrown (talk)21:04, 19 July 2013

when doing a sort, pages with no value for a property don't show up

see for a demo. thanks!

David Mason (talk)21:07, 24 May 2013

Wikitext not working inside property displayed with show

Edited by author.
Last edit: 14:46, 16 May 2013

Did #show change between SMW 1.7.1 and In my current setup (1.7.1) we do:

{{#set: Intro section={{{Intro section|}}} }}

{{{Intro section|}}} is set using Semantic Forms, and allows the user to type something like:

=== Sub-Section One ===
This is some intro text...

=== Sub-Section Two ===
This is more intro text...

Then this intro section can be included in another page. Of course we'd prefer to do LabeledSectionTransclude, but that doesn't appear to work with Semantic Forms since the Labeled Section can't be wrapped in an template.

In SMW 1.7.1 this worked just fine, using {{#show: My Page | ?Intro section }}. In it does not work: we get unformatted wikitext.

If instead I do {{#ask: [[My Page]] | ?Intro section }} it properly formats the wikitext, but it puts it inside a table.

Jamesmontalvo3 (talk)22:55, 15 May 2013

Workaround: declare a template {{==}} that merely displays its only argument: {{{1|}}}. Then use {{#show: My Page | ?Intro section | format = template | template = ==}}.

Alex Mashintalk04:54, 16 May 2013

That's a good workaround, thanks. Does anyone know if there is good reason for #show to not work this way anymore? Or is it an oversight? Seems like #show is broken if this doesn't work.

Jamesmontalvo3 (talk)14:47, 16 May 2013

I checked #set on an old SMW Version and the notion of {{#set: Intro section={{{Intro section|}}} }} would not create any annotation within a normal wikipage because the #set only works on an invoked Parser object (which does the pre-processing, template parsing etc.) this means any pre-parsing of template content need to be finished before #set is called.

MWJames (talk)16:39, 16 May 2013

Query not working with particular redirect

I have a peculiar situation where querying (ask or show) using a redirect will not work, but the full page name will. So {{#show:DDCU|?Mass}} will not work, but {{#show:DC to DC Converter Unit|?Mass}} will ("DDCU" redirects to "DC to DC Converter Unit"). The same is the case with #ask. Furthermore, browsing for properties on the redirect page shows nothing for DDCU (says This page has no properties), but on other redirect pages it shows all the same properties as on the pages they redirect to. How do I fix this?

Jamesmontalvo3 (talk)21:23, 17 January 2013

By editing and re-saving the redirect page (titled "DDCU" above) the problem is "solved". Why does that fix the problem? How does the redirect page in this one case not get access to the properties, when all other redirect pages don't seem to have that problem?

Jamesmontalvo3 (talk)21:55, 17 January 2013

>> Why does that fix the problem?

Because by the time you re-save the page, the page is recognized (which by then is a synonymous) as a redirect and the target source starts to inherent the redirects properties (only direct redirects count, a redirect of a redirect will have no effect).

>> How does the redirect page in this one case not get access

I don't really remember (haven't looked at Store3) but what normally happens is that when you initiate a redirect of a page the container (with all its properties) gets delete from the the database and only after a job run/or re-save (see above) this page is recognized with an internal state of "_REDI" which makes the redirected source properties part of the new target page.

Also there is a difference of doing a page move (including a redirect) and just doing a redirect (#REDIRECT) which involves different code to be executed. For a more closer look of the inner workings of the redirect handling see SMWSQLStore3Writers updateRedirects() and changeTitle().

MWJames (talk)05:59, 18 January 2013

#ask Problem

I have a Problem using the #ask-Command. My query is: {{#ask:[[1. Januar::+]]}}. It works for the year-attributes like {{#ask:[[1901::+]]}}, but not for the "day of the month"-Attributes. What can I do? Red Rooster (talk) 21:18, 27 December 2012 (CET)

Red Rooster (talk)21:18, 27 December 2012

"1 January" or "1901" is usually a value of some property of type "Date", rather than, as you're assuming here, the property itself. I'd recommend the following steps:

  • Choose a name for the date-type property that you want to use, for instance "Has date".
  • On the page of that property (in this hypothetical case, "Property:Has date"), declare it as being one of type "Date".
  • Then, on the pages where you need it, create the annotation, for example [[Has date::1901]] (the bit that comes before the colons is the property "Has date"; what comes after is the value of this property).
  • A query for pages that share the value "1901" for this property would look like {{#ask: [[Has date::1901]] }}.

For advice on the use of SMW and any problems that you might encounter, it's best to turn to the mailing lists. The talk pages for this site relate to the documentation for SMW.

Cavila (talk)13:39, 17 January 2013

Distinct weblinks

I am thinking of a way to show all weblinks present on the wiki.

    {{#ask: [[Has homepage::+]]
     | ?Has homepage
     | ?Category
     | format=table
 Has homepageCategory
Access Control List extensions
Semantic MediaWiki documentation
Plurilingual pages
Obsolete pages
Admin Links extensions
Semantic Bundle extensions
Effective pages
Semantic MediaWiki documentation
... further results

But the problem is that many links come up many times.

Is there a way to do distinct selection on the propery "Has homepage" so that no link will show up more then once in the result?

Maybe the solution is obvious, but I couldn't find it.

Best regards, Martin Wiss

Martinwiss (talk)22:21, 30 October 2012

Something like DISTINCT in SQL? Try to ask in mailing lists, I don't remember such feature.

Yury Katkov (talk)15:47, 31 October 2012

I do not think that this is possible either. However, give it a shot at the mailing list. Cheers

[[kgh]] (talk)22:01, 31 October 2012