Release 15.12 of the repository software has been tagged and is running on the production system.
This was primarily a maintenance release focused on refactoring of code and updating dependencies.
Have you ever been out walking and wondered if DRI contains any objects related to your current location?
No, neither have I, but having taken a short online course in Android development I thought I’d put together
a simple app to do this.
First we need a basic Android application that will display a map. There are plenty of guides
available on how to do this, for example here.
Next is to find out where the user is and to receive updates on their location
as they move. How to do this is covered well in the Android developer guide.
A very brief summary is:
Give the application permission to access location services in the app manifest
Create an API client and a LocationRequest object
Once the client is connected (i.e., in the onConnected() callback) request location updates
The current location will be updated through the onLocationChanged() callback
Each time we receive a location update we process it in the handleNewLocation() method. In this method
the user’s current latitude and longitude are retrieved, a marker is added to the map, and this location
is then passed to the code that handles finding the nearby objects from the DRI repository.
In a previous post I talked about mapping in the DRI repository. Adding the mapping interfaces involved configuring Solr
to support spatial searches. We can use this functionality here to retrieve the objects close to the user’s location.
The url to perform a spatial query looks like this:
The response is in JSON format and contains the Solr documents of all the objects matching the query (i.e., all the objects
within a certain spatial distance of the given co-ordinates). Rather than display every object the app will only add
markers at each place, with the number of objects at that place added as a label. Querying the repository and processing
the results is all performed in an AsyncTask separate to the MainActivity. This is done as the network request
and subsequent processing could take some time and the app should not stop responding during this.
To retrieve the response a connection is made to the search URL followed by a GET request
contentAsString contains the JSON response and this is returned for parsing.
The org.json API is used to parse the JSON. As stated above, as the app will
only display counts of the objects at locations we can parse the facet output contained in the response
rather than each object.
For each entry added to the placeList a marker is added to the map.
The marker shows the number of objects.
Clicking on the marker displays the placename.
Clicking on the title opens the device’s browser and displays the objects in the repository that contain that placename in their metadata.
The screenshots above show the working application running on an emulator of a Nexus 5.
During the run up to the DRI launch, to take a break from ingesting collections, I was playing around with a JavaScript page-turner. I re-visited that recently to make it work through the repository API, rather than connecting directly to the Solr service. This was so that it could be used as a standalone application outside of the local network. I took this as an opportunity to play around with some JavaScript and CSS in Rails. I guess it turned into more of an exercise in self-assembly rather than DIY, as I pieced a lot of existing code together.
Turn.js is a JavaScript library that makes it easy to create a nice looking flip book. With this library the code needed to create and display a book with hardcoded pages was straightforward. The idea was to build the book dynamically using images from a collection stored in the DRI repository. To do this it was necessary to have a way to translate page numbers to object IDs. For at least one of our collections this was possible thanks to a field in the object metadata that could be mapped to the page number:
By using a Ruby template string, the identifier can be obtained from the page number quite easily:
The object’s ID can be retrieved by submitting a query to the repository containing this identifier. Once we have the ID the list of available images for that object can be retrieved with another API call. The repository returns a JSON list of file URLs. Using the URL from this list that corresponds to the format needed the page can be created and added to the book.
For no reason other than I thought it might look nice I started looking at how to add a bookshelf to hold the ‘books’. Finding and following this blog post, http://www.hmp.is.it/making-a-fancy-book-using-html5-canvases/, showed how it could be done. It makes use of CSS, HTML5 and JavaScript. Taking the code and integrating it with the Rails asset pipeline allowed the book to be displayed on a ‘shelf’. Clicking the book links through to the flip book.
The final stage was to try out Heroku to deploy the app as a demo. You should be able to access it at https://dry-savannah-3204.herokuapp.com/books. I’m using the free service, so it might not always be available.
Obviously this isn’t the cleanest solution, and it could do with a lot of tweaking, but as an exercise in the Rails pipeline it was quite useful.
editor’s can remove draft objects and individual assets attached to draft objects
completed DOI implementation
Completing the DOI functionality means we can now begin the process of minting DOIs for the collections currently published in the repository. Initially this will be done on a collection by collection basis. Once configured, collections ingested in the future will be assigned DOIs at time of publication.
One of the most requested features for the Digital Repository of Ireland was a mapping interface for the objects stored in the repository. As the repository is built using Hydra, which includes the Blacklight Solr discovery interface, we were able to quickly add this using Blacklight Maps.
Blacklight Maps adds a set of mapping views to the Blacklight UI. An extra field, geojson_ssim, added to the Solr index specifies the objects location on the map. This field is formatted in GeoJSON, which looks like the following (taken from the Blacklight Maps docs):
For DRI an object’s location is contained in its descriptive metadata in XML format. In Dublin Core the dcterms:spatial term is used:
On ingestion this term is transformed to the required GeoJSON format before it is stored in the Solr index.
An extra feature that we support is the use of Linked Data URIs within an object’s spatial metadata, specifically Linked Logainm URIs. The benefit of supporting URIs is that it allows the cataloguer to enrich their metadata with spatial information using the Logainm RDF reconciliation service through tools such as OpenRefine. The Logainm technical document gives more information on how this is achieved.
Turning the URIs contained in the XML, like this:
into the required GeoJSON format Solr field is a two stage process. The first step is where SPARQL is used. A SPARQL query, with the uri value from the XML metadata, retrieves the co-ordinates from the Linked Logainm SPARQL endpoint:
For a full explanation of the structure of the query see the Linked Logainm technical document.
The client makes use of the Ruby Sparql client to send the query to the Logainm endpoint and to retrieve the results.
The second step is to iterate through the result set to create the co-ordinates for the location and to then transform these to the GeoJSON Solr field for display on the map: