Skip to content

Instantly share code, notes, and snippets.

@lawlesst
lawlesst / ldf-hdt-heroku.md
Last active September 26, 2015 17:00
Notes on running ldf-server on Heroku with an HDT backend

September 25, 2015

Steps to run ldf-server on Heroku with an HDT backend.

  • Read the Node troubleshooting guide from Heroku for background.
  • Run the commands in the Start with a Blank Slate section of the guide.
  • Add package.json to your git repository if it isn't already.
  • For my project, I had to explicitly add hdt - 1.2.2 as a dependendency.

package.json

@lawlesst
lawlesst / petl.md
Last active September 27, 2015 00:12
Quick intro to petl for VIVO Apps & Tools working group.
@lawlesst
lawlesst / README.md
Last active August 29, 2015 14:27
VIVO modifications to display data pulled from ldf-vivo.herokuapp.com.

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

@lawlesst
lawlesst / read_dumped_triples.py
Created June 1, 2015 13:03
Read triples dumped from Jena SDB via SQL and convert to n-triples
"""
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 / fuseki-fulltext-config.ttl
Last active November 15, 2021 16:45
Minimal working Fuseki TDB with with full text search.
@prefix : <http://localhost/jena_example/#> .
@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 text: <http://jena.apache.org/text#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .
## Example of a TDB dataset and text index
## Initialize TDB
@lawlesst
lawlesst / readme.md
Last active August 29, 2015 14:11
University linking with OrgRef and VIVOs

##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 / rdflib_stardog.py
Last active July 14, 2021 03:38
Example code for working with Stardog from Python.
"""
Example code for connecting to Stardog (http://stardog.com/) with
Python's RDFLib (http://github.com/rdflib).
See longer description: http://lawlesst.github.io/notebook/rdflib-stardog.html
"""
#!/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 / 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"
# 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"