Query for Pages with subobjects

From semantic-mediawiki.org

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

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?

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:

{{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
...
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?

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}}}
{|
!'''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
}}

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

{{#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?

10:48, 18 March 2015

I added the 'silent' form of annotation and IT WORKS - thank you very much.

Hmm I thought that I know the differences but it looks like I need some more studies to know how it works and how to use it.

13:23, 18 March 2015

It is recommended that you have a look at the examples cited in Help:Subobjects and queries.

If you think the examples are insufficient in order to understand how queries work, you might want to help out/point out where documentation needs improvement so others can participate.

17:26, 18 March 2015