Semanticmediawiki: Question - how to properly link to subobject using PageForms

Created on 6 May 2020  路  2Comments  路  Source: SemanticMediaWiki/SemanticMediaWiki

Setup and configuration

  • SMW version: 2.5.8
  • MW version: 1.27.3
  • PHP version: 7.0.33
  • DB system (MySQL, Blazegraph, etc.) and version: MySQL 5.7.30

Issue

  • A Page is using a Form to create a master/detail presentation of an entity.
  • The entity stores it's property with the page using SMW properties.
  • The detail entities store it's information using subobjects.
  • The detail entities my reference other detail entities on the same or other pages as "parent"

The corresponding PageForm entry is:

{{{field|parent|property=SchemaProperty parent|input type=combobox|values from concept=SchemaProperty}}}

We tried two approaches. One was using anonymous subobjects https://www.semantic-mediawiki.org/wiki/Help:Adding_subobjects

By using the template:

subobject={{#subobject:-
|isA=SchemaProperty
|SchemaProperty id={{{id|}}}

in which case automatic subobject identifiers are created and in Pageforms are represented in selection list e.g. as
grafik

This is not very user friendly.
When changing the template to:

subobject={{#subobject:{{{id|}}}
|isA=SchemaProperty
|SchemaProperty id={{{id|}}}

The drop down list looks much nicer:
grafik

But when storing the result we get an error message:
grafik

Question

How could we achieve a user friendly presentation in PageForms but still be able to properly store the link to a parent subobject whithin another subobject?

Steps to reproduce

see above

question

All 2 comments

Interesting question. I you would not use subobjects, but regular pages, you could use DISPLAYTITLE to get other page titles displayed, however this cannot be used with subobjects.

Two more things to consider: maybe try the mapping capabilitites of Page Forms:
https://www.mediawiki.org/wiki/Extension:Page_Forms/Input_types#Setting_values_and_mappings
I have onyl tried this once and failed, but this might be related to an earlier version of PF. I would assume that in the most recent one it should work as expected.

Secondly, maybe your values from concept poses a problem I had once a problem with this and Yarons answer was, that he is not testing this anymore. So it might be possible that it has something to do with this. Can you try valeues from category= as subobjects can be assigned a category which should work as any other category

Subobjects are not well liked by the SMW community. In the past 5 years i found quite a few valuable use cases for them. Subobjects are very handy if you have a lot of details for a single instance of an entity and it's not worthwhile to go thru the costly hassle of keeping pages for all of them. Subobject pages have search&replace for everyone while pages can only search&replaced by admins is one reason but there are many more.

https://meta.wikimedia.org/wiki/Template:Anchor
{{anchor|target}}

might help for the target problem - if the subobject markup would automatically create an anchor may be optionally that would be a plus - is that already a feature or would that be a separate issue?

Was this page helpful?
0 / 5 - 0 ratings