ESSI-LOD Python Framework

From Earth Science Information Partners (ESIP)


In a prior implementation of the ESSI-LOD linked data, we used a Java code base to scrape AGU HTML pages for abstracts. Having coordinated with AGU to produce convert directly from bulk text files for meeting abstracts, we rewrote the implementation in Python. This wiki page has documentation on how to use (and extend) this Python framework.

Setting up the Framework


  • Python 2.x
  • Virtuoso 6.1.x



Convert AGU meetings into RDF

  • Move .txt file(s) that must be converted into staging directory (e.g., /projects/abstracts/python/data/agu/staging)
  • Change working directory to Python ESSI-LOD project root (i.e., /projects/abstracts/python/essilod)
  • Run: ./ --sparqlMatching /path/to/staging/directory [/path/to/output/directory/optional]
    • If you need to regenerate RDF for keywords or sections, use the --keywords and --sections flags, resp.
    • Note, this process will take a little while to run as it loads all the organization identifiers into main memory (for conflation purposes)
  • After the process has finished running, check the output .rdf files for syntax using the rapper utility: rapper -c /path/to/data.rdf
  • For clarity, here is a list of commands to run when FM13 data is released:
 cp ~/fm13.txt /projects/abstracts/python/data/agu/staging
 cd /projects/abstracts/python/essilod
 ./ --sparqlMatching ../data/agu/staging
 cd ../data/agu/staging
 rapper -c -i turtle fm13.rdf
 rapper -c -i turtle people.rdf
 rapper -c -i turtle organizations.rdf

Load RDF into triple store (i.e., index)

Convert AGU Session info into RDF

Versioning for AGU

In order to reduce down time of the AGU abstract browser, we have introduced graph versioning so that new data can be loaded while old data is still operational.

The new convention for URIs is:{version}/{year}/{meeting_type_ID} (Note, the previous convention for URIs was:{year}/{meeting_type_ID})

We have introduced a new optional parameter in the utility (see above section on loading the data) for version info. The usage is:

 python /path/to/data/dir [version_ID] [base_URI] [/path/to/vload] [file_extension]

In a typical versioning scenario:

  • A user may have regenerated metadata from the meeting .txt files (including meetings, keywords, sections, people, and organizations)
  • They may want to reuse the static.ttl file being used by a previous version.
    • Be sure to find/replace the instances of the old versioned URI and replace it with the new version, e.g.: =>
  • Load the .ttl files using the script (setting the correct version ID)
  • Update the necessary files in LODSPeaKr to use the new version graphs:
    • Change the static GRAPH reference and the graph metadata reference in /projects/abstracts/lodspeakr/components/includes/

Manual fixes for meeting data

Sometimes the easiest way to make a fix is to edit the Turtle RDF (.ttl) files directly...

Here are a few examples to clarify. Say we needed to fix a typo in the title of an abstract for FM12:

 Edit /projects/abstracts/python/data/rdf/fm12.ttl, find and replace the incorrect title
 /projects/abstracts/virtuoso-scripts/vload ttl fm12.ttl

Or, if we needed to fix a type in the name of an AGU index term (i.e., keyword):

 Edit /projects/abstracts/python/data/rdf/keywords.ttl, find and replace the incorrect title
 /projects/abstracts/virtuoso-scripts/vload ttl fm12.ttl

Other utilities

Entity Classes

The Entity classes are for objects converted directly into RDF. They are typically instantiated either by a Stream class or by another Entity class.


Stores metadata about AGU meetings, such as year, type identifier (e.g., FM), and the set of associated AGU meeting sessions.


Stores metadata about AGU meeting sessions, such as identifier, name, conveners, sponsoring session, and set of associated AGU meeting abstracts.


Stores information about AGU meeting abstracts, such as identifier, title, authors, and keywords, as well as the abstract itself.


Stores information about AGU meeting abstract authors, such as name, email and affiliation.


Stores information about AGU session conveners, such as name and affiliation.


Stores information about AGU keywords, such as description and identifier.

Stream Classes

The Stream classes are utility classes for consuming bulk files containing entities. They are typically instantiated directly from a main program.


  • Parses AGU .txt files for meeting abstracts
  • Iterates over chunks of the document delimited by HTML comment lines (i.e., )
  • First attempts to process chunk as Abstract, then Session if Abstract extractor (HtmlAbstract) throws an exception
  • Uses HtmlAbstract and HtmlSession subclasses to extract data


  • Parses AGU .dat files for meeting sessions
  • Iterates over each line, extracting a Session instance for each
  • Uses SessionSummary subclass to extract data

Lookup Classes

The lookup classes are used for entity conflation purposes. I.e., to consolidate URIs when the evidence provides for it.