A SQL Interface for the SCA Armorial

As powerful as the Morsulus O-and-A software is, it’s not particularly easy to install and get running on your own computer, and it’s a bit daunting to extend with new functionality.

I had an idea that it would be easier to work with the armorial data if it was loaded into a regular SQL database, and spent my weekend putting together a proof-of-concept implementation.

The results are available as Clerk-0.1.tar.gz, a pair of Perl scripts designed to work with a MySQL database.

The first, make.pl, will fetch the armorial data from the SCA’s web site, create database tables to hold it, import the data, and do a bit of cross-indexing to make searching easier.

$ ./make.pl
No changes made; you are up-to-date.

The second, search.pl, accepts command-line arguments that parallel the various options supported by the Morsulus O-and-A interface, and outputs the matching registration records.

$ ./search.pl --armory "PFESS:pl:argent:~and vert" --armory BEAST-BEAR:1:primary --armory BEAST-BEAR:gules:primary --armory "BEAST-BEAR:passant to dexter:primary" --armory "BEAST-BEAR:spa" --close
Found 2 results

Here is one matching item with an exact match:

Mathghamhain Ua Ruadháin
  This device was registered January of 2017 via the East.
  Per fess argent and vert, a bear passant gules.

Here is one matching item with one difference:

Halldor Rauthbjorn
  This badge was registered May of 2002 via the Middle.
  (Fieldless) A bear passant guardant gules maintaining on its back a castle argent.

Both include usage information you can view by running them with --help.

The search results generally match up to those from the original Morsulus search, although I don’t yet have all of the character-code support in place for broad-vs-narrow name searches, and I haven’t yet implemented date/kingdom search criteria.

I’ve also added a couple of features that aren’t available in the baseline tool.

One that would be easy to add to the Morsulus code is a --min-score parameter, including shortcuts for --exact, which only returns items that match all of the provided search terms, and --close, which includes items that have at most one difference; both of these just set the minimum score based on the maximum possible weight.

A new feature that would be more difficult to add to the Morsulus scripts is the ability to search for any of several headings at once, for example --armory "ROSE|FOIL-6", or even to search for any heading at all, such as looking for any sable tertiary with --armory "*:sable:tertiary".

The code is available under a permissive open-source license so feel free to use or modify it as you would like.

One thought on “A SQL Interface for the SCA Armorial”

Leave a Reply

Your email address will not be published. Required fields are marked *