Skip to content

Instantly share code, notes, and snippets.

View no-reply's full-sized avatar

tamsin woo no-reply

  • UC Santa Barbara Library
  • United States
View GitHub Profile
@no-reply
no-reply / error.txt
Created September 16, 2014 16:47
unicode error
Sep 16 09:35:38 akara[8157]: [ERROR] Uncaught exception from 'geocode' ('http://purl.org/la/dp/geocode')
Traceback (most recent call last):
File "/home/tjohnson/src/dpla/ingestion/ENV/lib/python2.7/site-packages/akara/multiprocess_http.py", line 304, in _wsgi_application
result = service.handler(environ, start_response_)
File "/home/tjohnson/src/dpla/ingestion/ENV/lib/python2.7/site-packages/akara/services.py", line 417, in wrapper
result = func(*args, **kwargs)
File "/home/tjohnson/src/dpla/ingestion/ENV/lib/python2.7/site-packages/dplaingestion/akamod/geocode.py", line 63, in geocode
place.enrich_geodata(DplaGeonamesGeocoder())
File "/home/tjohnson/src/dpla/ingestion/ENV/lib/python2.7/site-packages/dplaingestion/akamod/geocode.py", line 526, in enrich_geodata
coded_place = geocoder.enrich_place(self)
@no-reply
no-reply / annotation.ttl
Created September 19, 2014 17:38
Annotation Demo
<http://purl.org/dc/dcmitype/Image> a <http://www.w3.org/2000/01/rdf-schema#Class> .
<http://vocab.getty.edu/aat/300132472> a <http://vocab.getty.edu/ontology#Concept> .
[
a <http://www.w3.org/ns/oa#Annotation>;
<http://www.w3.org/ns/oa#annotatedAt> "2014-09-19T10:33:56-07:00"^^<http://www.w3.org/2001/XMLSchema#dateTime>;
<http://www.w3.org/ns/oa#hasBody> [
a <http://www.w3.org/2011/content#ContentAsText>;
<http://purl.org/dc/elements/1.1/format> "text/plain";
@no-reply
no-reply / proposal.md
Last active August 29, 2015 14:06
Code4Lib 2015 Preconference Proposal: DPLA API Workshop

DPLA API Workshop & Hackfest

'''Half Day'''

Abstract:

@no-reply
no-reply / post.java
Created September 26, 2014 15:20
Marmotta SPARQL Direct Post Queries
/**
* Single endpoint for direct post queries (not yet implemented)
*
* @param request
* @return
*/
@POST
public Response post(@Context HttpServletRequest request) {
//String query = CharStreams.toString(request.getReader());
//TODO: introspect the query to determine the operation type
@no-reply
no-reply / gist:5f81b48faa2f2f1d5df1
Created September 26, 2014 18:55
ansible error
TASK: [postgresql | Make sure our databases exist] ****************************
failed: [webapp1] => (item=dpla_portal) => {"failed": true, "item": "dpla_portal"}
msg: Database query failed: encoding UTF8 does not match locale en_US
DETAIL: The chosen LC_CTYPE setting requires encoding LATIN1.
@no-reply
no-reply / sparql.rb
Created October 11, 2014 18:16
Marmotta Ask Bug(?)
subject.query_client.ask.whether([:s, :p, :o]).to_s
# => "ASK WHERE { ?s ?p ?o . }"
subject.query_client.ask.whether([:s, :p, :o]).true?
# => true
subject.query_client.ask.whether([:s, RDF::DC.title, 'my item']).to_s
# => "ASK WHERE { ?s <http://purl.org/dc/terms/title> \"my item\" . }"
subject.query_client.ask.whether([:s, RDF::DC.title, 'my item']).true?
require 'mime/type' #=> NameError: uninitialized constant MIME
require 'mime' # works fine, but then `Mime` exists and `MIME` does not
@no-reply
no-reply / aggregation_json.rb
Created October 23, 2014 17:31
Aggregation as JSON (possible initial indexing strategy)
require 'factory_girl'
include FactoryGirl::Syntax::Methods
require 'dpla/map/factories'
agg = build(:aggregation)
agg.to_json
# => => "{\"aggregatedCHO\":[{\"alternateTitle\":[\"Stonewall Inn Graffiti\"],\"collection\":[{\"title\":[\"Diana Davies photographs, 1965-1978\"],\"description\":[\"Photographs of Diana Davies; LGBT and HIV/AIDS Activist Collections\"]}],\"contributor\":[{\"label\":[\"Norma Ford\"],\"providedLabel\":[\"Norma Ford\"],\"exactMatch\":[],\"closeMatch\":[]}],\"creator\":[{\"label\":[\"Davies, Diana (1938-)\"],\"providedLabel\":[\"Norma Ford\"],\"exactMatch\":[],\"closeMatch\":[]}],\"date\":[{\"providedLabel\":[\"1969.\"],\"begin\":[\"1969-01-01\"],\"end\":[\"1969-12-31\"]}],\"description\":[\"Window of the Stonewall Bar N.Y. 1969. The other half of the graffiti was erased by the time Diana photographed it.\"],\"extent\":[\"10x12 cm\"],\"format\":[\"Silver Gelatin Print\"],\"genre\":[{\"id\":\"http://vocab.getty.edu/aat/300132472\",\"prefLabel\":[],\"providedLabel\":[],\"exactMatch\":[],
@no-reply
no-reply / agg.json
Created October 23, 2014 19:19
DPLA Aggregation JSON-LD
puts agg.dump(:jsonld, {standard_prefixes: true})
{
"@context": {
"aat": "http://vocab.getty.edu/aat/",
"dc": "http://purl.org/dc/terms/",
"dc11": "http://purl.org/dc/elements/1.1/",
"dcmitype": "http://purl.org/dc/dcmitype/",
"dpla": "http://dp.la/about/map/",
"edm": "http://www.europeana.eu/schemas/edm/",
"iso_639_3": "http://lexvo.org/id/iso639-3/",
@no-reply
no-reply / context.jsonld
Last active August 29, 2015 14:08
DPLA MAPv4 Context & Frame
{
"@context": {
"aat": "http://vocab.getty.edu/aat/",
"dc": "http://purl.org/dc/terms/",
"dc11": "http://purl.org/dc/elements/1.1/",
"dcmitype": "http://purl.org/dc/dcmitype/",
"dpla": "http://dp.la/about/map/",
"edm": "http://www.europeana.eu/schemas/edm/",
"iso_639_3": "http://lexvo.org/id/iso639-3/",
"ore": "http://www.openarchives.org/ore/terms/",