Help:BEACON

From Linux Web Expert

Revision as of 11:46, 9 December 2018 by >Kghbln (chg)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Starting with Semantic MediaWiki 3.0.0Released on an unknown date unknown versions of MediaWiki and later result format "Templatefile"Outputs results in arbitrary file formats defined via templates. should be used instead.

BEACON is a specification for interchanging GND data. This page describes the basic concepts and a workaround on how to implement this in Semantic MediaWiki as long as there is no decicated result format for this.

GND and BEACON

GND is an international authority file for the organisation of personal names, subject headings and corporate bodies from catalogues. It is used mainly for documentation in libraries and increasingly also by archives and museums. The GND is managed by the German National Library (German: Deutsche Nationalbibliothek; DNB) in cooperation with various regional library networks.

For more information, see

Use Case

It seems a strange idea to provide a simple txt file in a SMW based solution that has the possiblity of providing more state-of-art formats like JSON or RDF. But anyway, in case you need to deliver such a file, there is a workaround as long as we don't have a result format for this.

Implementation in SMW 3.x and above

See Help:Templatefile_format

Implementation prior to SMW 3.x

provide a GND property

First you need to add an property of type text holding the GND number: Property:Has GND

Lets look at a simple table with Persons available in this wiki:


use the result format template

You then create three pages:

Query
{{#ask:
 [[Category:Person]]
 |mainlabel=Name
 |?has GND=GND
 |format=template
 |introtemplate=BEACONIntro
 |template=BEACON
 |link=none
 |named args=yes
 |searchlabel=-
}}
Result

The resulting output is:


use &action=render

This looks like a BEACON file, but is not quite one, because it is supposed to be a plain text file, not a wiki page. There are two possibilities:

  1. copy the content of this file, paste it in a text editor, save it as text, upload it to your web server and use that (don't forget to change your meta information in case you to this).
    1. Disadvantage is obviously, that the file doesn't change as your content changes.
  2. use this trick: add "&action=render" [1] to the link, like this: https://www.semantic-mediawiki.org/wiki/BEACON?action=render
    1. This way, you can deliver a text file that automatically updates.
    2. Disadvantage: it is not 100% according to the specification, as there the file is starting with "<pre>".

optional: use variable "PAGEID"

Even better than delivering the page name John Doe, is to provide the PAGEID[2] that stays stable even when you rename your page. You have two possiblities for that:

  1. use the extension Semantic Extra Special Properties
  2. add your own property, e. g. called Property:Has PageID and set in your Template:Person the value with the magic word[3] {{PAGEID}} like this:
    {{#set:Has PageID={{PAGEID}}}}
    . Then you have to change the Template:BEACON and BEACON to use the page id instead of the page name.

References