Help:BEACON

From semantic-mediawiki.org
Starting with Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. 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[edit]

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[edit]

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[edit]

See Help:Templatefile_format

Implementation prior to SMW 3.x[edit]

provide a GND property[edit]

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[edit]

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: 20240329065905
#UPDATE: always
||
||

use &action=render[edit]

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"[edit]

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[edit]