Skip to content

Instantly share code, notes, and snippets.

import rdflib
raw = """
<rdf:RDF
xmlns:vitro-public="http://vitro.mannlib.cornell.edu/ns/vitro/public#"
xmlns:c4o="http://purl.org/spar/c4o/"
xmlns:ero="http://purl.obolibrary.org/obo/"
xmlns:pvs="http://vivoweb.org/ontology/provenance-support#"
xmlns:owl2="http://www.w3.org/2006/12/owl2-xml#"
xmlns:scirr="http://vivoweb.org/ontology/scientific-research-resource#"
@prefix fuseki: <http://jena.apache.org/fuseki#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix : <#> .
# Declaration additional assembler items.
[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .

Google / Open Refine Reconciliation

Latest release is Google Refine 2.5. OpenRefine beta candidate available and moving forward the project is independent of Google.

Documentation and downloads available from the Open Refine website.

A useful tool in the ongoing work to move from strings to things.

Overview

>OpenRefine (ex-Google Refine) is a powerful tool for working with messy data, cleaning it, transforming it from one format into another, extending it with web services, and linking it to databases like Freebase.

@lawlesst
lawlesst / wos.php
Created January 23, 2014 19:51 — forked from domoritz/wos.php
<?php
$auth_url = "http://search.isiknowledge.com/esti/wokmws/ws/WOKMWSAuthenticate?wsdl";
$auth_client = @new SoapClient($auth_url);
$auth_response = $auth_client->authenticate();
$search_url = "http://search.isiknowledge.com/esti/wokmws/ws/WokSearchLite?wsdl";
$search_client = @new SoapClient($search_url);
$search_client->__setCookie('SID',$auth_response->return);
$search_array = array(
@lawlesst
lawlesst / mod_cache.conf
Last active August 29, 2015 13:55
mod_cache.conf config for VIVO caching on Redhat
#
#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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
"""
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).
# 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 July 30, 2014 16:02
Minimum subclass of ShibbolethRemoteUserMiddleware.
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"