Help:Subobjects and queries

Table of Contents

This help page describes how to query for subobject after they were added to your wiki.

Show all subobjects of a page

Using #subobject does not print out anything on the screen. Sometimes one would like to show the subobject data directly on the page where it is defined. This can be achieved with the ask query {{#ask: [[-Has subobject::{{FULLPAGENAME}}]] }} which is added after the definition of subobjects.

Defining two subobjects with identifiers "first" and "second":



Then to print out the subobjects one would insert this code on the same page:

 [[-Has subobject::{{FULLPAGENAME}}]] 

Note the "-" which is necessary to make the query work (see Inverse Properties for more information).

Show properties of a subobject's parent page

In some cases one might not only want to query for subobject data but also for "usual" properties that are defined on the subobject's parent page. The process to do that contains the following steps:

  1. Query for a property of a subobject.
  2. Use format=template.
  3. Add another query in this template where you ask for [[Has subobject::{{{1}}}]]. Has subobject returns the parent page of a subobject. The subobject is queried in the first query and passed on to the template as {{{1}}}.

In Template:YourTemplate one adds the following:

 [[Has subobject::{{{1}}}]]

Examples/Queries/Use subobject with template

See also