Skip to content

Instantly share code, notes, and snippets.

@lawlesst
lawlesst / mod_cache.conf
Last active Aug 29, 2015
mod_cache.conf config for VIVO caching on Redhat
View mod_cache.conf
#
#The default expire needs to be 0 in a self-editing environment so that E-Tags can be reverified.
#Requests to cached URLs that haven't expired will never reach the VIVO web application.
#
<IfModule mod_cache.c>
CacheRoot /var/cache/apache2
CacheEnable disk /display
CacheEnable disk /individual
CacheIgnoreNoLastMod On
View pubmed-disambig.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View faculty-ingest.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View get_next_uri.py
"""
Mint random number based IRIs.
"""
BU = Namespace('http://vivo.brown.edu/individual/')
def get_next_uri(self, prefix='n', number=1, used_uris=[], max=99999):
"""
Mint new URIs in the VIVO pattern (e.g. n1234).
View tracject_indexer.rb
# Set up a reader and a writer
# First we need to require the reader/writer we want
require 'traject'
require 'traject/marc4j_reader'
require 'traject/debug_writer'
settings do
provide "reader_class_name", "Traject::Marc4JReader"
provide "marc_source.encoding", "UTF-8"
@lawlesst
lawlesst / middleware.py
Created Jul 30, 2014
Minimum subclass of ShibbolethRemoteUserMiddleware.
View middleware.py
from shibboleth.middleware import ShibbolethRemoteUserMiddleware, ShibbolethValidationError
class MyAppAuthenticationMiddleware(ShibbolethRemoteUserMiddleware):
"""
Handle login via Shibboleth and permissions for viewing and
editing profiles and resources.
"""
header = "Shibboleth-localId"
View deploy-vitro-jetty.sh
#!/bin/sh -e
set -x # Print commands and their arguments as they are executed.
JETTY_HOME=/dock/jetty7.6.14
VITRO_HOME=/tmp/vitrohome
STAGE_DIR=/tmp/vbuild
ant clean distribute -Dskiptests=true
#ant distribute -Dskiptests=true
@lawlesst
lawlesst / readme.md
Last active Aug 29, 2015
University linking with OrgRef and VIVOs
View readme.md

##University Linking

Using OrgRef to link universities represented in VIVOs to DBPedia and to each other.

  • Exploring how VIVO instances could share data like this and reuse URIs.
  • Crawled eight VIVO instances and pulled back data about Universities.
  • Matched each site to OrgRef using simple string normalization and equality.
  • Matched OrgRef to DBPedia using the Wikipedia Page IDs included by OrgRef.
  • Matched VIVOs to DBPedia
  • Loaded data into a Linked Data Fragments server: http://ldf-vivo.herokuapp.com/orgref
@lawlesst
lawlesst / read_dumped_triples.py
Created Jun 1, 2015
Read triples dumped from Jena SDB via SQL and convert to n-triples
View read_dumped_triples.py
"""
Used chardet library to find encoding - it reported:
{'confidence': 0.7158930206047512, 'encoding': 'ISO-8859-2'}
Use line writing to print ntriples as they are read to avoid
memory issues with storing all statements in an in memory
RDFLib Graph.
"""
@lawlesst
lawlesst / README.md
Last active Aug 29, 2015
VIVO modifications to display data pulled from ldf-vivo.herokuapp.com.
View README.md

Sample files for pulling data into a VIVO instance from Linked Data Fragments, Wikidata, and Wikipedia.