Tuesday, July 16, 2013

Nomisma: A More Detailed Look at Public Features

On Friday, the new Nomisma.org was launched, and the previous blog post included a general overview of the new APIs and SPARQL endpoint.  In this post, I'll discuss in more detail some specific new features that have been implemented and how these features function under the hood.


While hoard and mint pages included Google Maps that displayed KML in the previous version of Nomisma, the process by which this KML is generated has changed in the new version (in addition to the move to OpenLayers).  The id for Rome (http://nomisma.org/id/rome), for example, includes a map with KML generated from a SPARQL query.  One point is created for the mint and multiple points generated for the findspots of coins minted in Rome.  This query gathers all of the findspots, defined as an http://nomisma.org/id/findspot [nm:findspot], regardless of whether the mint of Rome is defined within the object RDF itself explicitly or implicitly through a reference to a coin type URI.  See the following query:

PREFIX rdf:      <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dcterms:  <http://purl.org/dc/terms/>
PREFIX nm:       <http://nomisma.org/id/>
PREFIX skos:      <http://www.w3.org/2004/02/skos/core#>
PREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>
SELECT DISTINCT ?object ?findspot ?lat ?long ?title ?prefLabel WHERE {
{?type nm:mint <http://nomisma.org/id/rome> .
?object nm:type_series_item ?type.
?object nm:findspot ?findspot .
?findspot geo:lat ?lat .
?findspot geo:long ?long
?object nm:mint <http://nomisma.org/id/rome> .
?object nm:findspot ?findspot .
?findspot geo:lat ?lat .
?findspot geo:long ?long
OPTIONAL {?object skos:prefLabel ?prefLabel}
OPTIONAL {?object dcterms:title ?title}
The SPARQL results are piped through an XSLT stylesheet that converts them into KML placemarks (see the templates with mode="kml").

Maps are generated in similar fashion for coin types (see http://nomisma.org/id/rrc-299.1b).  A point is created for the mint from which the coin was issued, and multiple points are created for findspots associated with that type.  KML is also created for hoards defined by Nomisma, such as IGCH 664, though in this case the KML is serialized not from SPARQL results, but from aggregating relating mint XHTML records together (which is more efficient than initiating multiple SPARQL queries).  While the maps have only been implemented on hoard, mint, and coin type record pages, they can be implemented for other types of ids in the future: for example to show the mints active under the authorities Alexander the Great or Diocletian and the circulation of their coinage, or to show the mints and circulation of denarii or tetradrachms.

Examples of Coin Types

Coin type ids will show examples of the type, similar to OCRE.  The record for RRC 299/1b shows, beneath the map, an example of 2012.92, located in the Virginia Museum of Fine Arts (although the data continues to be published by the University of Virginia Library).  The query for this page looks like:

PREFIX rdf:      <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dcterms:  <http://purl.org/dc/terms/>
PREFIX nm:       <http://nomisma.org/id/>
SELECT ?object ?title ?publisher ?identifier ?collection ?weight ?axis ?diameter ?obvThumb ?revThumb ?obvRef ?revRef  WHERE {
?object nm:type_series_item <http://nomisma.org/id/rrc-299.1b>.
?object rdf:type <http://nomisma.org/id/coin>.
?object dcterms:title ?title .
?object dcterms:publisher ?publisher .
OPTIONAL { ?object dcterms:identifier ?identifier } .
OPTIONAL { ?object nm:collection ?collection } .
OPTIONAL { ?object nm:weight ?weight }
OPTIONAL { ?object nm:axis ?axis }
OPTIONAL { ?object nm:diameter ?diameter }
OPTIONAL { ?object nm:obverseThumbnail ?obvThumb }
OPTIONAL { ?object nm:reverseThumbnail ?revThumb }
OPTIONAL { ?object nm:obverseReference ?obvRef }
OPTIONAL { ?object nm:reverseReference ?revRef }}
ORDER BY ASC(?publisher)

Flickr Images

For time being (until/if abuse of the system ever occurs), Nomisma will display Flickr images which have been tagged with Nomisma-compliant machine tags.  See for example the record for Augustus, which displays one picture uploaded by the Portable Antiquities Scheme tagged with nomisma:authority=augustus.  Nomisma leverages the Flickr APIs to query for associated machine tags and display up to twelve images.

<xsl:variable name="predicate" select="if ($typeof='roman_emperor') then 'authority' else $typeof"/>
  <xsl:variable name="photos" as="element()*">
    <xsl:copy-of select="document(concat($service, '&amp;method=flickr.photos.search&amp;per_page=12&amp;machine_tags=nomisma:', $predicate, '=', $id))/*"/>
  <xsl:if test="count($photos//photo) &gt; 0">
    <div class="center">
      <h3>Flickr Images of this Typology (<a href="http://www.flickr.com/photos/tags/nomisma:{$predicate}={$id}">See all photos.</a>)</h3>
      <xsl:for-each select="$photos//photo">
        <div class="flickr_thumbnail">
          <a href="http://www.flickr.com/photos/{@owner}/{@id}" title="{@title}"><img src="{document(concat($service, '&amp;method=flickr.photos.getSizes&amp;photo_id=', @id))//size[@label='Thumbnail']/@source}" alt="{@title}"/></a>

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.