Jump to content

Topic on Extension talk:HierarchyBuilder

Features request: formlink capability for non-existent pages / filter display on semantic query

3
Xavi (talkcontribs)

Would it be possible to display a page creation form when the user clicks on a non-existent page in the tree? also would it be possible to filter the pages displayed in the tree based on the value of a semantic property of the page (e.g. Is active::true), or even better, using an ask query

Thank you.

Cindy.cicalese (talkcontribs)

Thank you for your feedback. We will add those features to our list of requests. We also welcome patches in gerrit.

Xavi (talkcontribs)

Thank you for adding these features to the request list. I have used a workaround approach to display pages based on a semantic query; I am sharing it here in case someone else needs to use a similar functionality in the meanwhile.

Instead of hard-typing a list of pages I used:

  • a subobject (my_hierarchy) containing the semantic properties of the page
  • an ask query with a template to generate the list of pages

Assuming we have this semantic property:

  • semantic_property_group_id: indicates the id of the group to which the page belongs to

and being the my_hierarchy subobject definition:

{{#subobject:my_hierarchy
| semantic_property_group_id=enter_group_id_here
}}

The query would look like this:

<hierarchy>
{{#ask:[[semantic_property_group_id::enter_group_id_here]]
 |link=none
 |format=template
 |template=Has subobject list
 |limit=500
}}
</hierarchy>

Where the template "Has subobject list" contains:

<includeonly>* [[{{#ask: [[Has subobject::{{{1}}}]] | link=none}}]]</includeonly>

To create a multilevel list I used an ask query with ultree format and a template.

Assuming we have these semantic properties:

  • semantic_property_group_id: indicates the id of the group to which the page belongs to
  • semantic_property_parent_page: indicates the "parent" page of the current page

and being the my_hierarchy subobject definition:

{{#subobject:my_hierarchy
| semantic_property_group_id=enter_group_id_here
| semantic_property_parent_page=enter_parent_pagename_here#my_hierarchy
}}

The query looks like this:

<hierarchy>
{{#ask:[[semantic_property_group_id::enter_group_id_here]]
 |format=ultree
 |link=none
 |template=Has subobject hierarchy
 |parent=semantic property parent page
 |limit=500
}}
</hierarchy>

Where the template "Has subobject hierarchy" contains:

<includeonly>[[{{#ask: [[Has subobject::{{{1}}}]] | link=none}}]]</includeonly>

To sort the pages I use another semantic property:

  • semantic_property_page_index: indicates the position of the page among its "siblings"

and being the my_hierarchy subobject definition:

{{#subobject:my_hierarchy
| semantic_property_group_id=enter_group_id_here
| semantic_property_page_index=enter_page_index_here
| semantic_property_parent_page=enter_parent_pagename_here#my_hierarchy
}}

the ask definition will include:

 |sort=semantic property page index
 |order=ascending

adding the property with underscores does not seem to work:

 |sort=semantic_property_page_index
 |order=ascending
Reply to "Features request: formlink capability for non-existent pages / filter display on semantic query"