Thursday, March 28, 2019

Migrating quantitative analyses in Numishare to d3.js

I have spent the last few weeks making some significant updates to Numishare in order to accommodate two scenarios in publishing coin type corpora online within the framework:

  • To create an umbrella site that encompasses PELLA, Seleucid Coins Online and Ptolemaic Coins Online for the NEH-funded Hellenistic Royal Coinages project. This requires some updating of the Numishare config to include URIs for multiple type corpora to join SPARQL and Solr queries together for the browse interface, geographic visualizations, and quantitative analyses.
  • To make it possible for a digital type corpus to completely stand alone with its own SPARQL endpoint (for Clare Rowan's project on Roman tokens). Although a SPARQL endpoint can be specified in the Numishare config, various parts of the application still relied on APIs for displaying related specimens in the browse page or average weights and diameters on coin type record pages. This makes it difficult to test the development of a type corpus since types are not ingested into until they are completed, and specimens are not integrated into Nomisma until they have been assigned permanent URIs.

As a result, I have successfully implemented the joining of SPARQL and Solr queries for the HRC umbrella site, which I hope we can launch by May (even though Ptolemaic Coins Online is only partially completed).

Map of the full distribution of Seleucid and Ptolemaic coinage, based on current data.

It is now possible to compare the average weight of tetradrachms of Ptolemy I with those of Antiochus I through one interface that enables the query across these disparate datasets.

Since I had to conduct significant revisions to the underlying SPARQL queries in Nomisma to facilitate these joins, I moved forward with a task that has been on my agenda for the last three years: to migrate the semi-proprietary Highcharts Javascript library to the much more robust and community-supported d3.js. I had previously implemented this library for distribution and metrical analyses in itself. So I adapted code I had already written in Nomisma in order to generate APIs in Numishare that would construct complex SPARQL queries from URL parameters and serializing the resulting output into the JSON model required by d3.js. Like Nomisma, the API will also serialize the results into CSV for further revision or analysis in other platforms.

The average weight tetradrachms of Ptolemy I and Antiochus I

Unlike the Nomisma interfaces, which are exclusively in English, I have adapted those in Numishare to provide the results in each of the languages supported by the framework. If a preferred label exists in Nomisma for a given concept, it will be displayed. If not, it will default to English.

Distribution of denominations produced by Antiochus I vs. Ptolemy I, in French

Before these updates, the metrical analyses in Numishare were built on SPARQL, but the distribution visualizations were based on facets indexed into the Solr search index. These Solr facet-based distributions applied to both coin type and physical specimen collections. The old /visualize link will continue to exist in Numishare, particularly for specimen collections, but a warning message informs user of type corpora that the Solr-based distributions will be deprecated eventually. The Solr distributions are particularly powerful because the Solr queries might include searches for legends, iconographic descriptions, and fuzzy searches with wildcards. This can be implemented in SPARQL eventually, but the new interface currently only allows queries for typological categories connected to Nomisma-defined concepts (denominations, people, mints, etc.), as well as start and end dates.

The Solr-based distribution analysis interface has also been migrated from Highcharts to d3.js, and an API has been adapted to transform a series of Solr queries (for comparisons) into the d3.js JSON model (with optional CSV downloads, also).

Distribution of mints of Antiochus I to Seleucus I

I have compared the result of these charts derived from Solr with those derived from SPARQL, and the resulting statistics are identical. They weren't in the initial testing, as the first version of the SPARQL query including all subtypes as well. But any type that has a skos:broader property has been suppressed from the query, enabling a consistent comparison of parent types. The charts derived from Solr are multilingual only if the language has been enabled in the Numishare config and the types have been reindexed into Solr following the activation of these languages in the interface.

Since metrical analyses are being fully migrated to d3.js with a different array of HTTP request parameters, old URLs that point to these charts will be forwarded to the new URL pattern to maintain backwards compatibility.

This migration from Highcharts to d3.js is nearly complete, and I hope to move this significant changes to production by the end of April. Expect the Hellenistic Royal Coinages umbrella site to be launched sometime between late April and mid-May.

Highcharts remains for data visualization in Coin Hoards of the Roman Republic, but this will be migrated next.

Wednesday, March 6, 2019

University of Mannheim joins Nomisma

The University of Mannheim digital coin cabinet, part of the NUMiD consortium, has made 29 Roman imperial coins available in OCRE.

Examples of RIC Hadrian 396
Mannheim is the 35th contributor to OCRE. Roughly have of all institutions contributing to OCRE are from NUMiD.