inicio mail me! sindicaci;ón

Using Web Services Tutorial

In this tutorial you will learn how to find Web Service feeds and you will get to transform them into a list of results formatted with the colour and font of your choice. I have prepared a set of PHP files for the Web Service Transformer that will help me demonstrate the power of XML. If you want to continue to work with this I have published them under a creative commons license allowing you to use and make changes to them.


CC-GNU GPL

This software is licensed under the CC-GNU GPL version 2.0 or later.

First let’s have a look at the Web Service Transformation interface. This is a simple form which allows you to submit some parameters that will determine the outcome of the list.

The first parameter is Web Service. For this parameter you need to find a XML feed. Here are some places you can go to find these feeds:

The second parameter is Tag. If we use the example from the Flickr API again we can use the Flickr URL for the method flickr.photosets.getPhotos calling the photoset with the ID = 72157622862470902

The photo-set id can be found in the URL when you look at the photoset on Flickr. The same goes for photos and collections. For group ID and Flickr User ID you can use the idGettr tool where you copy/paste the URL and it gives you the ID.

http://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos&api_key=a8ee0e80254383b35779042d3fadb5d6&photoset_id=72157622862470902&privacy_filter=1&api_sig=4b60ccfb80deb813f72f36c440cb8286

If we input this URL into the interface and check the Print XML only box we will see the XML returned. From this XML we can pick out a tag to use e.g. <photo>

The third parameter is Attribute which allows you to choose an attribute from the tag you chose earlier. In this case I will choose title. Note that this parameter is optional.

The fourth parameter is Colour – have a look at COLOURlover for inspiration.

The fifth parameter is Font – have a look at Larabie‘s fonts for inspiration (you can also see the fonts here)

The parameters input are used to build an XSLT (eXtensible Stylesheet Language Transformation) file which transforms the XML from the Web Service into HTML in the colour and font you chose.

Your turn

  1. Use Flickr Explorer to display a description of a photo from the Vindolanda Fort at Hadrian’s Wall in a red shade and a font beginning with ‘G’
  2. Use Flickr Explorer to display the amount of members in the flickr group ‘Roman Empire’ in a shade of blue and a font beginning with ‘B’
  3. Using APPELLO for the Vindolanda tablets display a list of geographical places with the letter ‘b’ in the name in a green shade and a font of your choosing
  4. Using APPELLO for the Vindolanda tablets display a list of people named ‘flauius’ each with the tablets they occur in listed below the name in a purple shade and a font of your choosing
  5. Using the Baby Name API display your own name in your favorite colour and a font that begins with the same letter as your name

Resources for DHR Lecture 29.10.10

I am once again doing a lecture on the wonder of XML for the Digital Resources in Humanities course at UCL. The lecture is called: ‘Wow, it’s XML! and this post is an update of the post from last years class.

You should also have a look at the post on using the Flickr API and of course the post where the photos themselves are displayed with the help of SimpleViewer.

Essential Websites

eSAD – e-Science and Ancient Documents: http://esad.classics.ox.ac.uk

Vindolanda – http://www.vindolanda.com

VTO – Vindolanda Tablets Online: http://vindolanda.csad.ox.ac.uk/

VTO2 – Vindolanda Tablets Online II: http://vto2.csad.ox.ac.uk/

EpiDoc – Epigraphical Documents in TEI: http://epidoc.sourceforge.net

Contextual encoding

Hippisley, D. (2005) “Encoding the Vindolanda tablets: an investigation in contextual encoding using XML and the EpiDoc standards.” MA Dissertation submitted for the MA in Electronic Communication and Publishing, School of Library, Archive and Information Studies, UCL.

RESTful Web Services

Abeysinghe, S. 2008. RESTful PHP Web Services, Birmingham: PACKT Publishing

Fielding, R. T. 2000. Architecture Styles and the Design of Network-based Software Architectures,

Richardson, L.  and Ruby, S. 2007. RESTful Web Services, Cambridge: O’Reilly

Spies, B. 2008. Web Services, Part 1: SOAP vs. RESThttp://ajaxonomy.com/2008/xml/web-services-part-1-soap-vs-rest (25.11.09)

eSAD

Some of these publications are available via the eSAD website

Roued-Cunliffe, H. 2010. Towards a Decision Support System for Reading Ancient Documents, Literary and Linguistics Computing, doi: 10.1093/llc/fqq020

Olsen, H. R. , Tarte, S. , Terras, M. , Brady, M. and Bowman, A. K. 2009. Towards an Interpretation Support System for Reading Ancient Documents, Digital Humanities Conference 2009

Tarte, S. 2010. Papyroligical Investigations: Transferring Perception and Interpretation into the Digital World, Literary and Linguistics Computing – forthcoming,

Tarte, S. , Brady, M. , Olsen, H. R. , Terras, M. and Bowman, A. K. 2008c. Image acquisition & analysis to enhance the legibility of ancient textsE-Science All Hands Meeting 2008

Terras, M. 2006. Image to Interpretation. An Intelligent System to Aid Historians in Reading the Vindolanda Texts, Oxford University Press

WordPress plugins

SimpleFlickr

Using the Flickr API – updated

This is a case study of how you can use Web Services to access information from another web application in your own blog.
Flickr have an application called the Flickr API Explorer where you can put together a URL to call up the Web Service.

API garden interface
API garden interface

Picture 5

The API garden have a list of the available methods, which you can choose and then you can use the application to put together the correct URL.

This is the URL I put together to get a list of photos from a specific set using the flickr.photosets.getPhoto method:

http://api.flickr.com/services/rest/?method=flickr.photosets.getPhotos

&api_key=4a06b7a0bd9daf198b8d5d100297e47c

&photoset_id=72157621516651630

&privacy_filter=1

&api_sig=71f331b8456e21c7ab0a614683abe55e

Picture 4

I have used this information to display these images on my own blog. In reality I could write some XSLT (eXtensible Stylesheet Language Transformation) and display them any way I want but in this case I have cheated and used wordpress and the SimpleFlickr plugin to display the photos in a blog post.

Minor breakthrough on the ‘enter’ front

Having worked for quite a while on creating the new VTO2 website I sent it around a while ago to my supervisors to see what they thought. Imagine my disappointment when one of them replied that they couldn’t get the fancy AJAX (Asynchronous Javascript And XML) search engine to work. I double checked everything and couldn’t for the life of me figure out why it wasn’t working on her machine. I don’t remember how I realised it but it became apparent that when she had typed a search pattern in she then pressed ‘enter’ / ‘return’. This was bit of a ‘duh’ moment for me. I had myself been so fascinated by the AJAX LiveSearch abilities that I had managed to create that I hadn’t stopped to think that one of the first reactions most people will have to a search-box is most naturally to press ‘enter’.

So I searched the web far and wide and came up with no solution. I then decided to make sure that when ‘enter’ submitted the form it just went back to the same page allowing the user to begin again. I then added a request below asking that the user did not press ‘enter’ while doing a search.

But then today while I was moving the whole website to a new (and yeah – much faster) server it struck me to search for “ajax deactivate enter”. Up came this post about “Disable form submit on enter keypress” written by Slobodan Kovacevic in 2005.

I did as he suggests and ‘hey presto’ it worked in Firefox, Safari and I presume IE (although I haven’t checked this yet). I was amazed because normally when I have small but very significant issues like that it takes ages to find the answer. But not this time.

Colloquium at British Academy

The last couple of days the eSAD project have had our Colloquium on “e-Research on Texts and Images” at the British Academy, London.

Alejandro Giacometti, postgraduate student at UCL, has been summing up the talks!

This has been a very useful event for my research. As I am in the midst of writing up the chapter on the research and literature background leading up to my project I found many of the talks very enlightening.

I talked shortly about APPELLO (the word-search Web Service that I have been building recently) and Tom Elliot talked about how they are trying to make their resources and tools available and open. I was very interested in this, as it would be great to be able to use larger resources as knowledge bases for the Decision Support System. More on this later, I’m sure…

Next entries »