Building Bibliographic RDF Applications and Microservices

Setup Environment

1. Download and install Python 3

Download and install the latest Python 3 distribution (currently 3.6) from the Python website. If you already have Python 3 installed, please go to the next step

2. Create a Project Directory

Microsoft Windows

mkdir C:\tmp\rdf-app

POSIX (Linux, MacOS)

mkdir /tmp/rdf-app

3. Create a Python Virtual environment

Microsoft Windows

  1. python3 -m venv C:\tmp\py3-env
  2. C:\tmp\py3-env\Scripts\activate.bat
  3. (py3-env)> C:\

POSIX (Linux, MacOS)

  1. python3 -m venv /tmp/py3-env
  2. source /tmp/py3-env/bin/activate
  3. (py3-env)> /

4. Install dependencies with PIP

Download requirements.txt

Download and save the preconference requirements.txt (available on Github at requirements.txt) to your root Project directory.

Microsoft Windows

  1. (py3-env)>cd C:\tmp\rdf-app
  2. (py3-env)C:\tmp\rdf-app>pip install -r requirements.txt

POSIX (Linux, MacOS)

  1. (py3-env)> cd /tmp/rdf-app
  2. (py3-env)cd /tmp/rdf-app>pip install -r requirements.txt

5. Clone BIBCAT and RDFFramework

Use git to clone BIBCAT and RDFFramework projects inside your project directory. You can also download a zip of each repository from Github if you do not have git installed.

Microsoft Windows

  1. (py3-env)C:\tmp\rdf-app>git clone https://github.com/KnowledgeLinks/rdfw-bibcat.git bibcat
  2. (py3-env)C:\tmp\rdf-app>git clone https://github.com/KnowledgeLinks/rdfframework.git rdfw

POSIX (Linux, MacOS)

  1. (py3-env)/tmp/rdf-app>git clone https://github.com/KnowledgeLinks/rdfw-bibcat.git bibcat
  2. (py3-env)/tmp/rdf-app>git clone https://github.com/KnowledgeLinks/rdfframework.git rdfw

6. Run RDF Triplestore

Download Blazegraph or use the jermnelson/semantic-server-core Docker image.

Using Docker

docker run -p 8080:8080 -p 9999:9999 jermnelson/semantic-server-core:dev

Standalone Java JAR file

After downloading the Blazegraph Jar file, you can run a simple instance of Blazegraph using java

java -server -jar blazegraph Blazegraph should now be running at

7. Create an instance directory and config.py

Microsoft Windows

  1. (py3-env)C:\tmp\rdf-app>mkdir instance
  2. (py3-env)C:\tmp\rdf-app>touch instance\config.py

POSIX (Linux, MacOS)

  1. (py3-env)/tmp/rdf-app>mkdir instance
  2. (py3-env)/tmp/rdf-app>touch instance/config.py

Add and set these config.py variables

BASE_URL
URL used for generating IRI
SECRET_KEY
Set this to any random string of characters
TRIPLESTORE_URL
Set this URL to the running Blazegraph instance from the previous step
DEFAULT_RDF_NS
A Python dictionary that maps namespace prefixes with a URL

Example config.py

BASE_URL = 'http://bibcat.org/'
DEFAULT_RDF_NS = {
    "kds": "http://knowledgelinks.io/ns/data-structures/",
    "kdr": "http://knowledgelinks.io/ns/data-resources/",
    "bf": "http://id.loc.gov/ontologies/bibframe/",
    "dpla": "http://dp.la/about/map/",
    "skos": "http://www.w3.org/2004/02/skos/core#",
    "loc": "http://id.loc.gov/authorities/",
    "mods": "http://www.loc.gov/mods/v3",
    "dc": "http://purl.org/dc/terms/",
    "es": "http://knowledgelinks.io/ns/elasticsearch/",
    "edm": "http://www.europeana.eu/schemas/edm/",
    "schema": "http://schema.org/",
    "xsd": "http://www.w3.org/2001/XMLSchema#",
    "ore": "http://www.openarchives.org/ore/terms/",
    "owl": "http://www.w3.org/2002/07/owl#",
    "void": "http://rdfs.org/ns/void#",
    "dcterm": "http://purl.org/dc/terms/",
    "dc": "http://purl.org/dc/elements/1.1/",
    "dbo": "http://dbpedia.org/ontology/",
    "dbp": "http://dbpedia.org/property/",
    "dbr": "http://dbpedia.org/resource/",
    "m21": ""
}
SECRET_KEY ='b256efed34536fd67f48dbdfa192a7ea2fd553526afcfd1fcfebf7b21f2d1303'
TRIPLESTORE_URL = 'http://localhost:9999/blazegraph/query' 
                    

Steps for creating a development environment

  1. Download and install latest Python 3 distribution
  2. Create a directory for your project
  3. Create a Python Virtual environment
  4. Install dependencies with PIP
  5. Clone BIBCAT and RDFFramework
  6. Run RDF Triplestore
  7. Create an instance directory and config.py