Using Semantic Internal Objects to build dynamic Book gallery

Browsing books by its title and author is a standard feature off any library catalogue but sometimes one is animated to browse a book by its cover (visual rather textual search). Using Semantic Mediawiki can be help with this task when data sets about books are stored in a Mediawiki system.

The achieve this goal of a browsable book gallery, we use the help of Semantic Internal Objects (SIO) to store the data about objects that should be browsable. The selection process is supported by Semantic Forms (SF) RunQuery to define selection criterias (subject or book type) together with the help of Semantic Results Format (SRF) a gallery (standard Mediawiki)  is displayed containing only the selected objects (book covers).

By solely combing those components a dynamic gallery (as seen below) can be generated without any additional programming effort.

Video

How to …

For specific help on how to employee SIO[0], SF[1,2], and SRF, please see the links at the end. Looking at the book gallery, cover images are stored in the File: namespace[3] and together with a template that includes the setting for Semantic Internal Objects, the system stores required data every time the object (File page) is changed.

Solution

Most of the work is done by the embedded SIO manipulation in the File: namespace template, connected with a form ensuring that certain data structures and policies are followed to minimize the impact of unrelated content storage.

Storage (File namespace template)
{{
#set_internal:Is cover image for
 | Has image={{FULLPAGENAME}}
 | Is gallery member of=Book
 | Has caption=[[{{{1}}}|{{#show:{{{1}}}|?Title|link=none}}]] ({{#show:{{{1}}}|?Author|link=none}})
 | Has gallery category#list={{#show:{{{1}}}|?Keyword|link=none}}
 | Has object type#list={{#show:{{{1}}}|?Type|link=none}}
}}

Selection and display (RunQuery template)

The selection query (seen below) is used in a RunQuery template to generate the gallery output.

{{#if:{{{type|}}}|[[Has object type::{{{type|}}}]]}}{{#if: {{{keyword |}}}|[[Has gallery category::{{{keyword|}}}]]}}
| ?Has image
| ?Has caption
| format=gallery
| imageproperty=Has image
| captionproperty=Has caption
| link=none
| perrow=6
| offset={{{offset|0}}}
| limit={{{steps|5}}}
}}

The combination of the above modules, with some div and css tweaks allowing the display of a book gallery as seen in the first sceen dump.

Help

[0] Storing Semantic Internal Objects

[2] Using Semantic Forms to query data

[3] How to use templates, forms within a namespace

[3] http://www.mediawiki.org/wiki/Manual:Namespace

Note

We deliberately choose not to query external data (such as covers etc.) in order to save bandwidth and structure data according to our internal policies.

We are no experts nor developers and merely state our experience therefore we can’t give any advice beyond the description mentioned here and in future versions changes might not work any longer. We see the information supplied here only as to share experience which can vary with different setup’s, people are encourage to make improvements beyond what has been described here.