Jump to content

Dynamic links to external resources

From Meta, a Wikimedia project coordination wiki

Wikipedia and other Wikimedia projects provide a rich variety of links to external resources. These links come in the form of selected external links and as links to sources or literature. In general the links are manually selected. However some external sources may be relevant to a large and dynamic number of articles. For this purpose in the German Wikipedia there is a project to dynamically add links to selected sources. This enrichment by links is based on a link dump exchange format called BEACON. The final specification of BEACON is being worked on at http://github.com/gbv/beaconspec.

How does it work?

[edit]

The links are generated based on a given identifier. In the first project phase this is the GND which identifies people and which is widely used in German libraries.

The links are shown in a page of its own in the Personensuche on Toolserver. See http://toolserver.org/~apper/pd/person/Elisabeth_Mann_Borgese for an example: Links ("Auf anderen Webseiten") are shown to relevant external sources. These links include the number of hits and are updated automatically via BEACON files.

What is BEACON?

[edit]

BEACON is a simple file format to exchange links. See also:

In short a BEACON file contains a 1-to-1 (or 1-to-n) mapping from identifiers to links. Each link consists of at least an URL with optionally a link title and additional information such as the number of resources that are available behind a link.

Let's start with an example of a one-line BEACON file:

http://d-nb.info/gnd/121616614|http://saebi.isgv.de/pnd/121616614|Sächsische Biografie

This shows that about the object identified by the URI http://d-nb.info/gnd/121616614 (which is a person registered in the PND authority file) there is a relevant information at the URL http://saebi.isgv.de/pnd/121616614 and it can be labeled as "Sächsische Biografie". If there are multiple links, we can use some shortcuts and just provide one identifier on each line:

#FORMAT: BEACON
#PREFIX: http://d-nb.info/gnd/
#TARGET: http://saebi.isgv.de/pnd/{ID}
#MESSAGE: Sächsische Biografie

121616614
116241543

The lines starting with # are called "meta-fields". They must come before the identifier lines but can come in any order. You can also omit the PREFIX but then it is not obvious that '121616614' is a PND number but not some other kind of identifier (telephone number, postcode, credit cart number etc.). Moreover the identifier can be used as URI which makes fans of the Semantic Web happy.

If we link to sources that hold a larger number of material, for instance library catalogs, we should add the number of hits. The following file contains links from PND-Numbers to the Bavarian State library with the number of hits:

#FORMAT: BEACON
#PREFIX: http://d-nb.info/gnd/
#TARGET: http://opacplus.bsb-muenchen.de/search?pnd={ID}
#MESSAGE: Literatur im Katalog der Bayerischen Staatsbibliothek

118647717|2
119141612|10

So for instance for 119141612 which is http://d-nb.info/gnd/119141612 which is "Elisabeth Mann Borgese" there are 10 titles in their catalog ("Literatur im Katalog der Bayerischen Staatsbibliothek") and you can directly link to them with http://opacplus.bsb-muenchen.de/search?pnd=119141612.

If your target URLs are based on a different identifier, you can specify this target identifier after two vertical bars:

#FORMAT: BEACON
#PREFIX: http://dbpedia.org/resource/
#TARGET: http://data.nytimes.com/
#RELATION: http://www.w3.org/2002/07/owl#sameAs

Abaco_Islands||36492150692641534821
Abilene%2C_Texas||81952714548746232661

You can also list full target URLs one by one instead of providing a TARGET meta field:

#FORMAT: BEACON
#PREFIX: http://d-nb.info/gnd/
118643800||http://agso.uni-graz.at/lexikon/klassiker/addams/01bio.htm

If all target links are full URLs, one can also abbreviate by using a single vertical bar only:

#FORMAT: BEACON
#PREFIX: http://d-nb.info/gnd/
118643800|http://agso.uni-graz.at/lexikon/klassiker/addams/01bio.htm

There are some more details but all of them are optional so BEACON is really very simple, isn't it?

How does BEACON relate to RDF?

[edit]

A set of links published in BEACON format can be converted to RDF. By default the predicate of each link is just rdfs:seeAlso, but you can define another predicate in the BEACON header like this:

 #PREFIX: http://d-nb.info/gnd/
 #RELATION:  http://xmlns.com/foaf/0.1/primaryTopicOf
 #TARGET: http://saebi.isgv.de/pnd/{ID}
 #MESSAGE: Sächsische Biografie

 121616614
 116241543

This small BEACON file converted to RDF/Turtle can be expressed as:

 @prefix gnd: <http://d-nb.info/gnd/> .
 @prefix foaf: <http://xmlns.com/foaf/0.1/> .

 gnd:121616614 foaf:primaryTopicOf <http://saebi.isgv.de/pnd/121616614> .
 gnd:116241543 foaf:primaryTopicOf <http://saebi.isgv.de/pnd/116241543> .  

What is SeeAlso?

[edit]

SeeAlso is a simple API to query for links. See This article for details.

What is the relation between BEACON and SeeAlso?

[edit]

BEACON and SeeAlso are independent but compatible techniques. Both can be used to transfer the same information (which is relevant links to external resources). If you want to transfer a large bulk of links as one set, BEACON is your choice. If you want to dynamically query for some links, have a look at SeeAlso. If you just want to provide or get fine links to external resources without having to deal with technical issues then just ignore both and focus on content - surely links which are available in any form can be converted to BEACON and SeeAlso by the tekkies.

[edit]

Basically there are two options to include links from BEACON files in your own website, page, portal etc.

  1. You can harvest BEACON files and merge them with your own database
  2. You can query links via the SeeAlso API and dynamically include them on your web pages

The first option requires some programming skills (you may want to reuse the phpBeacon programming library) and depends on the internals of your application. The second requires someone else to set up a SeeAlso Server (if not already present) which delivers links from the BEACON file on request. You can use the SeeAlso JavaScript library to add additional links to your page with a few lines of HTML/JavaScript.

How can I contribute?

[edit]

You can just collect useful links and provide them in BEACON format. If you know some good sources of relevant links, then try to get them as simple mappings in BEACON format and contact us at the German Wikipedia page!

If you know any programming language then have a look at BEACON and SeeAlso implementations. There are many ideas for services to get implemented!