logo4 Evolution is progress—                          
progress is creativity.        
vline

Implement Zotero citations into a Django application

view wiki view wiki view wiki view wiki

I wanted to provide a simple method to create citations from my web pages. I use Zotero, so I would like to offer a one-click way to include my pages into any Zotero database.

Unfortunately, googling Django AND Zotero did not provide any clue. I did not find an application or or code snipped. Finally I found an easy solution through metadata. I created this page to provide links to resources and my first simple copy-and-past solution.

A good point to start from is this Zotero page http://www.zotero.org/support/dev/exposing_metadata. It offers many solutions that can be implemented in a django project. I found it a little bit disappointing that although a wordpress plug-in exists there is no django plug-in available from that web page.

Embedded Metadata

I found the Embedded Metadata approach most convenient. The easiest way would be to implement the Highwire key-value system, but as I understand the page's example this is only applicable for journal articles. It seems to me a bit awkward to represent a web page as a journal article, so I used the more flexible solution defined by Dublin Core description. I found this link even more useful as it lists all the key attributes available. Unfortunately, that resource does not provide enough examples to correctly format dates, for instance.

My code snippet has to be included into the templates follow below. The base template should contain:

[Error: Macro 'code' error: code() got an unexpected keyword argument 'lang']

and the application specific template:

[Error: Macro 'code' error: code() got an unexpected keyword argument 'lang']

But this solution has its drawbacks. The number of DC terms is quite limited.

COinS

COinS has also a good Wikipedia representation. The idea is to provide an empty span tag that in its title attribute contains all the information necessary to build the reference information. The Wikipedia example below contains white spaces that of course have to be removed from the title string.

[Error: Macro 'code' error: code() got an unexpected keyword argument 'lang']

For this technique journal and book templates are available. Here formats for other publication types are published.

The implemetation of that technique into django requires a function that creates the title attribute.

unAPI

By contrast to all previous solution in which all the data are included into the web page, unAPI requires a server that provided bibliographical data for a given web page, so the web page only provides the server address and the id, and all the bibliographical data are retrieved by s second request.

The server address is put into the head instruction.

[Error: Macro 'code' error: code() got an unexpected keyword argument 'lang']

The id is put into the body. The span tag necessary but helps to suppress the essential abbr tag.

[Error: Macro 'code' error: code() got an unexpected keyword argument 'lang']

Now by a second request the unapi can be retrieved by that get request:

http://vlib.mpg.de/aleph-cgi/unapi.cgi?format=mods&id=000206951

mods is a quite popular format. Most aunapi-server provide different formats you may choose the one your client prefers.


Tags: Software


Categories: Software

 
   

(c) Mato Nagel, Weißwasser 2004-2024, Disclaimer