Semantic Internal Objects to Headings

From semantic-mediawiki.org

Try {{#show: Bruce Wayne | NameFirst}}.

03:55, 7 November 2014

Thanks for that very good advice. The following provided the desired output: "Peter"

{{#show:[[Name::+]] [[NameFirst::Peter]] |?NameFirst }}

The following provided the output: "Bruce Bruce".

{{#show:[[Name::+]] [[NameFirst::Bruce]] |?NameFirst }}

This confused me until I realized that my data include: Bruce Wayne Bruce Banner

Thank you, thank you.

Have you any sense why both results come with the following error message?

Error

  • Some part ".." of the query was not understood.
  • The symbol "[[" was used in a place where it is not useful.
  • The part "]]" of the query was not understood. Result might not be as expected.
05:19, 7 November 2014

{{#show:}} shows a property of only one page. It's {{#show:Bruce Wayne | ?NameFirst}}, not {{#show:[[NameFirst::Bruce Wayne]] [[Name::+]] | ?NameFirst}}. I'm surprised it worked at all. If you need more complex query conditions than page name, use {{#ask:[[NameFirst::Bruce Wayne]] [[Name::+]] | ?NameFirst#- | format = list | mainlabel=- | limit=1 | searchlabel = - | headers = hide}}

09:01, 7 November 2014

I put in the following ask and get no output:

{{#ask:[[NameFirst::Bruce Wayne]] [[Name::+]] | ?NameFirst#- | format = list | mainlabel=- | limit=1 | searchlabel = - | headers = hide}}


I think this is because no property value corresponds to “Bruce Wayne” so I change [[NameFirst::Bruce Wayne]] to [[NameFirst::Bruce]]:

{{#ask:[[NameFirst::Bruce]] [[Name::+]] | ?NameFirst#- | format = list | mainlabel=- | limit=1 | searchlabel = - | headers = hide}}


This returns: Bruce-. I want to get rid of that “-” so I experimentally remove a “-” from the query and view the page without it. This makes for an unwanted output so I edit the query and repair what I broke. Then I try deleting another “-”. This testing proves that if I remove the “-” from “searchlabel”, I get a pure property value: Bruce

{{#ask:[[NameFirst::Bruce]] [[Name::+]] | ?NameFirst#- | format = list | mainlabel=- | limit=1 | searchlabel = | headers = hide}}


Lessons learned[edit]

In an #ask the first parameters are the object you are querying and the property value you are searching for. They come before the first pipe “|”. Otherwise, place order is not a factor so the following are equivalent:

  • {{#ask:[[NameFirst::Bruce]] [[Name::+]] | }}
  • {{#ask:[[Name::+]] [[NameFirst::Bruce]] | }}


Many formatting instructions can apply to a single query as long as no two contradict. Each must be separated by a pipe “|”.


This solution provides a fine grained example of how to provide multiple formatting instructions to a query. It also provides a working example so that an inexperienced user can make individual changes and see the result. This helps a new user get over a number of very basic mistakes. By new user I mean myself.

Thank you for walking me through this solution Alexander Mashin.

Equipped with this example, I feel confident of making a better class of mistakes.

17:44, 7 November 2014