Skip to content

Files

Latest commit

 

History

History

dev

Building and running emdates

To build and run the Docker image

$ docker build --no-cache -t emdates https://raw.githubusercontent.com/culturesofknowledge/emdates/master/dev/docker/Dockerfile
$ docker run -p 8080:8080 --name emdates emdates

You can find test page at: http://localhost:8080/static/index.html

Roman date parser

An initial implementation of a Roman date parser can be tested at: http://localhost:8080/static/index.html. Currently, the parser supports most canonical representations as well as common Quintilis and Sextilis variant forms such as V. Eid. Quin., dates written in combined Roman and Arabic numerals, such as XXI Maj 1646, and a small number of additional edge cases. We are experimenting with expressive error messages when the parser is unable to convert an input. For example, for Comitis Kal. Septemb. 1646, the parser responds, "Comitis is not part of a date. It means 'sent from', and is usually preceded by a place. Please remove."

cURL Examples

Example 1

Given a date "March 24, 1751" sourced somewhere in England, when was this on the Gregorian calendar we use today?

$ curl -s localhost:8080/convert -H 'Content-type: application/json' \
       -d '{"targetCalendar": "gregorian", "date": "1600-04-04", "place": "https://www.geonames.org/2755251", "targetCalendar": "Gregorian"}' \
       | jq -C .

Yields:

{
  "dates": {
    "1600-04-14": [
      "Date within Julian calendar start and end bounds",
      "Based on data for: \"Groningen (populated place)\""
    ]
  }
}

Example 2

You can use the following cURL command for parsing Roman Dates:

curl 'http://localhost:8080/parse/roman' -H 'Content-Type: application/json' --data '{"date":"V. Eid. Quin 1645."}' | jq -C .

This will yield:

{
  "parsedDate": "1645-07-11"
  "errorMessage": null
}

Uploading CSV files

Suppose we have a CSV file examples/bulkconversion.csv:

placeId

placeLabel

targetCalendar

inputDate

https://www.geonames.org/2755251

Groningen (populated place)

Julian

1648-01-30

https://www.geonames.org/3090048

Opole (populated place)

Julian

0900-10-11

no-id

Asgard

Julian

1584-01-05

then we can have this spreadsheet converted via the /convert/table API endpoint:

$ curl -s localhost:8080/convert/table -F file=@examples/bulkconversion.csv \

and end up with a converted CSV:

placeId

placeLabel

targetCalendar

inputDate

outputDate_0

notes_0

outputDate_1

notes_1

outputDate_2

notes_2

https://www.geonames.org/2755251

Groningen (populated place)

Julian

1648-01-30

1648-01-30

Based on default calendar

https://www.geonames.org/3090048

Opole (populated place)

Julian

0900-10-11

0900-10-11

"No place-specific data about when the New Year started, assuming 1 January (no adjustments), Date on or before end of Julian calendar, Based on data for place: 'Duchy of Opole'"

no-id

Asgard

Julian

1584-01-05

1584-01-05

Based on default calendar

Parsing Roman Dates

You can use the following cURL command for parsing Roman Dates:

curl 'http://localhost:8080/parse/roman' -H 'Content-Type: application/json' --data '{"date":"V. Eid. Quin 1645."}' | jq -C .

This will yield:

{
  "parsedDate": {
    "year": 1645,
    "month": 7,
    "day": 11
  },
  "errorMessage": null
}

Parsing multiple Roman dates

curl -F file=@examples/bulkparse.csv http://localhost:8080/parse/roman/bulk

The input looks something like this:

Id Date

1

IIII Idus Decemb. M D LXIIII.

2

20 Junii

3

"Nonis Aprilibus, stilo novo. …​ 1595."

This will yield the following output:

Id Date Result Message

1

IIII Idus Decemb. M D LXIIII.

1564-12-10

"Parsing 'IIII' as variant of 'IV' in: 'MDLXIIII', Parsing 'IIII' as variant of 'IV' in: 'IIII', Detected whitespace in roman numeral: 'M D LXIIII'"

2

20 Junii

XXXX-06-20

Missing year indication

3

"Nonis Aprilibus, stilo novo. …​ 1595."

"Encountered "" ""."" "". """" at line 1, column 30. Was expecting: <EOF> "

Using a local PlaceRegistry

...
- name: 'Helsinki (populated place)'
      placeId: 'https://www.geonames.org/658225'
    - name: 'Opole (populated place)'
      placeId: 'https://www.geonames.org/3090048'
      parent: 'https://emdates.org/1'
    - name: 'Duchy of Opole'
      placeId: 'https://emdates.org/1'
      calendarPeriods:
        - calendar: 'Julian'
          endDate: '1584-01-29'
          provenance: 'EM Places'
        - calendar: 'Gregorian'
          startDate: '1582-02-08'
          provenance: 'EM Places'
      startOfYear:
        - when: --01-01
          since: 1584
    - name: 'Groningen (populated place)'
      placeId: 'https://www.geonames.org/2755251'
      calendarPeriods:
        - calendar: 'Julian'
          endDate: '1583-02-28'
          provenance: 'EM Places'
        - calendar: 'Gregorian'
          startDate: '1582-03-11'
          endDate: '1594-11-19'
          provenance: 'EM Places'
        - calendar: 'Julian'
          startDate: '1594-11-10'
          endDate: '1700-01-XX'
          provenance: 'EM Places'
        - calendar: 'Gregorian'
          startDate: '1700-01-XX'
          provenance: 'EM Places'
      startOfYear:
        - when: --01-01
          since: 1583
...

Above is an excerpt of the current PlaceRegistry. Every place needs a placeId. This could be a GeoNames id, make one up if you do not have an id. This is what happened for Duchy of Opole.

calendarPeriods are the are the calendars used over time. These have optional properties beginDate and endDate, both use an ISO-8601 date expressed in the Gregorian calendar.

Using Timbuctoo (EMPlaces) as PlaceRegistry

To use Lobsang with the EMPlaces data set in Timbuctoo change the placeRegistry configuration to the next:

placeRegistry:
  "@class": nl.knaw.huygens.lobsang.core.places.timbuctoo.TimbuctooPlaceRegristryFactory
  uri: "https://uri.to.timbuctoo.instance/v5/graphql"
  dataSetId: "dataSetId"
  • "@class" is the name of the type of the of PlaceRegistry used by the application.

  • uri should point to the GraphQL endpoint of your Timbuctoo instance.

  • dataSetId is the id of the data set. It will look something like this: u33707283d426f900d4d33707283d426f900d4d0d__emdates_places

Use http://id.emplaces.info/place/Opole_P_EMPlaces as place parameter for the requests.

Background info

This Emdates implementation, before being moved over to the Github culturesofknowledge account, was named Lobsang (a character from the Discworld series). It deals with Julian / Gregorian calendar conversions given specific geographic locations and the Time at which they switched between using either calendar system.

Technical notes

To compile the Java code:

./gradlew clean build

Starting the application without docker execute (from the same folder as this file):

java -jar build/libs/lobsang-full.jar server config-template.yml

The application uses the Dropwizard framework. It is set up after the Getting started tutorial on the website.