Discuss Inline queries
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 Semantic MediaWiki user mailing list is always a good idea for seeking help.
Please, have a look at the archive discussions as well.
- [View source↑]
- [History↑]
Contents
Hi,
I was wondering if it's possible to have the printout from two different properties on the same column of a table. E.g.
{{#ask:
[[Category:Letters]]
|?Has sender=Sender
|?Has recipient=Recipient
|?Has uncertain date; ?Has certain date=Date
|format=datatables
|link=all
|headers=show
|mainlabel=Letter ID
|searchlabel=... further results
|class=sortable wikitable smwtable
|theme=bootstrap
|limit=1000
}}
I would like that data from ?has certain date and ?has uncertain date were stored in the same column.
Thanks for the help
Hello, I have a little problem in the Semantic 3 version between Show and Ask. I want to output the subject declared as a number so I can do more calculations later.
declared into templed
{{#subobject:{{{Turnier|}}} |Has object type=Eventberechnung |Has event={{{Turniername}}} |Has turnier_tanzahl={{#ask:[[Has object type::Event team]] [[Has event::{{FULLPAGENAME}}]] |format=count |default=0}} }} }}
Working is ok, Number 6 is correct,
Attribut:Has turnier tanzahl
Result: Testturnier 2016#Testturnier 2016BERE + 6 +
In the result template, I receive different results for ask and shown
{{#ask: [[Has object type::Eventberechnung]] [[Has event::{{FULLPAGENAME}}]] | ?Has turnier_tanzahl+ | mainlabel=-}}
Result: Testturnier 2016#Testturnier 2016BERE 6
I change ask by show I get the default zero, but i need only the Number 6;
With format=debug i get the Errors and Warnings
Das Symbol „[[“ wurde an einer Stelle verwendet, an der es nicht sinnvoll ist.
Der Teil „]]“ der Abfrage konnte nicht interpretiert werden. Die Ergebnisse entsprechen möglicherweise nicht den Erwartungen.
But I can not see where a "[[ ]]"does not make sense! How else should I determine the correct data record?
Links:
https://kubb311.kubbwiki.de/index.php/Testturnier_2016
https://kubb311.kubbwiki.de/index.php/Vorlage:Infobox_event3
https://kubb311.kubbwiki.de/index.php/Attribut:Has_turnier_tanzahl
https://kubb311.kubbwiki.de/index.php/Spezial:Version
I hope I presented my problem reasonably understandable? Thank you for your help!
A query that should have ~1800 lines of results has limit=2000. A portion of the results show, but then says "... further results". Why are the results not all showing on one screen? Tina Tenbergen (talk) 00:08, 24 October 2017 (CEST)
Did you have a look at $smwgQMaxInlineLimit ("maximal number of rows ever printed in a single inline query on a single page, even if a setting limit=... is given") and $smwgQMaxLimit ("maximal number of results ever retrieved, even when using special query pages")? You may have to adjust your local settings.
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.
Fixed with [0].
[0] https://github.com/SemanticMediaWiki/SemanticMediaWiki/pull/1270
If link is set to subject, what is the wiki supposed to do? I don't get it....
Examples/Different link parameter options should clarify the intention and usage.
Hallo!
I have a page with the following wiki-code which I fill with a semantic form:
{{EDV-Projekte
|Name=ZI Test 01
|Ziel=Test
|Kat=B2B
|Aufwand=keiner
|Team=BUC-ZIM
|Prio=X
|IstM=Dez
|IstY=2016
|Kom=keiner
|Status=unbearbeitet
|Anm=Test
}}
{{#subobject:
|Bezeichnung=Task 01
|Bearbeiter=MZ
|Datum=2015/03/10
|Status=unbearbeitet
|FaelligBis=2016/03/31
|Anmerkungen=Test 2
|TeilProjekt=EDV-Projekte/ZI TEST 01
}}
{{#subobject:
|Bezeichnung=Task 02
|Bearbeiter=MZ
|Datum=2015/03/10
|Status=im Plan
|FaelligBis=2018/03/31
|Anmerkungen=Test 3
|TeilProjekt=EDV-Projekte/ZI TEST 01
}}
{{#subobject:
|Bezeichnung=Test 3
|Bearbeiter=MZ
|Datum=2015/03/10
|Status=im Verzug
|FaelligBis=2015/11/26
|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:
{{#ask:
[[Hat Abfrage::+]]
|?Name
|?Ziel
|?Kat
|?Aufwand
|?Team
|?Prio
|?IstM
|?IstY
|?Kom
|?Status
}}
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
Michael
Could you explain what you're trying to do? Why are you using "Has query" / "Hat Abrage" for this?
I want to have a table with all the values from the first part not from the parts with {{#subobject:
{{EDV-Projekte
...
}}
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 | |||||||||
... |
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?
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}}} {| !'''Bezeichnung:''' |{{{field|subobject|hidden|default=}}}{{{field|Bezeichnung|mandatory}}} |- !'''Bearbeiter:''' |{{{field|Bearbeiter|input type=combobox|autocomplete|size=6|values=CB,KH,MS,MZ}}} |- !'''Datum:''' |{{{field|Datum|input type=datepicker|date format=dd.mm.yy}}} |- ! '''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 format=dd.mm.yy}}} |- |'''Anmerkungen:''' |{{{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> |- |'''Ziel:'''||'''{{{Ziel|}}} |- |- |Kategorie:||{{{Kat|}}} |- |Aufwand:||{{{Aufwand|}}} |- |Team:||{{{Team|}}} |- |Priorität:||{{{Prio|}}} |- |Zieltermin - Plan:||{{{PlanM|}}} {{{PlanY|}}} |- |Zieltermin - aktuell:||{{{IstM|}}} {{{IstY|}}} |- |Kommentar:||{{{Kom|}}} |- |'''Status:'''||'''{{{Status|}}} |- |Anmerkungen:||{{{Anm|}}} |} [[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 }}
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
{{#set: |Ziel={{{Ziel|}}} |Aufwand={{{Aufwand|}}} ..... }}
(etcetera .. you could fill in the rest)
For our user manual on creating semantic content, see 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?
I wanna make a table, but the data I need belongs to two different categories, How can I put the inline query?
Sounds like this is what you are looking for: {{#ask: [[Category:CatOneName||CatTwoName]] ...
More info: Help:Selecting_pages#Unions_of_query_results:_disjunctions
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.
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.
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..
It seems that I have misunderstood your question. In case you have a lot of result sets $smwgQMaxInlineLimit needs to be adjusted.
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.
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.
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:
- http://wikitranslate.org/wiki/Solfege - see Solfege Solfege ( ͡° ͜ʖ ͡°)
- http://wikitranslate.org/wiki/Special:Browse?title=Special%3ABrowse&article=Solfege
It doesn't work only on this page:
- http://wikitranslate.org/wiki/Prayers - see ( ͡° ͜ʖ ͡°) (it supposed to be Prayers Prayers ( ͡° ͜ʖ ͡°))
- http://wikitranslate.org/wiki/Special:Browse?title=Special%3ABrowse&article=Prayers
The script on the both of the pages is:
- {{#show:{{BASEPAGENAME}} | format = template | template = ==|?Surl= }} {{#show:{{BASEPAGENAME}} | ?Surl= }}
Did #show change between SMW 1.7.1 and 1.8.0.4? 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 1.8.0.4 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.
Workaround: declare a template {{==}} that merely displays its only argument: {{{1|}}}
. Then use {{#show: My Page | ?Intro section | format = template | template = ==}}
.
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.
I checked #set on an old SMW Version 1.7.0.2 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.
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?
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?
>> 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().
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)
"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.
I am thinking of a way to show all weblinks present on the wiki.
{{#ask: [[Has homepage::+]] | ?Has homepage | ?Category | format=table }}
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
I do not think that this is possible either. However, give it a shot at the mailing list. Cheers