Help:BEACON

From semantic-mediawiki.org

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

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:

 Has GND
John Doe123456789
Max Mustermann987654321

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:

#FORMAT: BEACON
#PREFIX: http://d-nb.info/gnd/
#TARGET: https://www.semantic-mediawiki.org/w/index.php?title=
#VERSION: 0.1
#HOMEPAGE: https://www.semantic-mediawiki.org/w/index.php?title=Help:BEACON
#FEED: https://www.semantic-mediawiki.org/w/index.php?title=BEACON&action=render
#LINK: http://www.w3.org/2000/01/rdf-schema#seeAlso
#INSTITUTION: Semantic MediaWiki
#MESSAGE: Person test data in Semantic MediaWiki
#TIMESTAMP: 20180525064041
#UPDATE: always
123456789||John Doe
987654321||Max Mustermann

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

  1. see https://www.mediawiki.org/wiki/Manual:Parameters_to_index.php/de#View_and_render
  2. https://www.mediawiki.org/wiki/Manual:Page_table#page_id
  3. https://www.mediawiki.org/wiki/Help:Magic_words#Technical_metadata