Skip to content

Instantly share code, notes, and snippets.

View dhistory-triples-file.ttl
@prefix arch: <http://purl.org/archival/vocab/arch#> .
@prefix bibo: <http://purl.org/ontology/bibo/> .
@prefix dc: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix locah: <http://data.archiveshub.ac.uk/def/> .
@prefix ore: <http://www.openarchives.org/ore/terms/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
<http://dhistory.org/archives/naa/items/7461003/1/#page> a arch:Manuscript,
View dhistory-triples-page.ttl
@prefix arch: <http://purl.org/archival/vocab/arch#> .
@prefix bibo: <http://purl.org/ontology/bibo/> .
@prefix dc: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix locah: <http://data.archiveshub.ac.uk/def/> .
@prefix ore: <http://www.openarchives.org/ore/terms/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
<http://dhistory.org/archives/naa/items/7461003/#series> a locah:ArchiveResource,
@wragge
wragge / gist:4700563
Created Feb 3, 2013
Adventures in text-mining Hansard... Topics of all questions asked in the House of Representatives in 1913.
View gist:4700563
[{'title': u'PANAMA EXPOSITION'},
{'title': u'ELECTORAL ADMINISTRATION'},
{'title': u'OODNADATTA-PORT AUGUSTA RAILWAY'},
{'title': u'SMALL-POX OUTBREAK'},
{'title': u'H.M.A.S. AUSTRALIA'},
{'title': u'MEAT TRUST IN QUEENSLAND'},
{'title': u'SUPPLEMENTARY ESTIMATES: LIGHTHOUSES'},
{'title': u'QUESTIONS: SMALL-POX OUTBREAK'},
{'title': u'MILITARY POLICY'},
{'title': u'ADDITIONS, NEW WORKS, BUILDINGS, ETC'},
@wragge
wragge / gist:4761998
Created Feb 12, 2013
Summary of bills debated in 1913
View gist:4761998
{u'APPROPRIATION (WORKS AND BUILDINGS) BILL': [{'date': '22/10/1913',
'num_speeches': 30,
'num_words': 45982,
'speakers': [u'FORREST, John',
u'FRAZER, Charles',
u'SPEAKER, Mr',
u'KELLY, William',
u'DEPUTY SPEAKER, Mr',
u'CHAPMAN, Austin',
u'HARPER, Robert',
View gist:5755845
0:05inside confession spies
0:08impact on
0:09week every copyright
0:14if
0:18i don't want to have to kya
0:25uh... think specific rules while applying
0:29in my technique
0:32disdain system site
0:38he'd
0:41dot con
@wragge
wragge / trove-random-article.js
Last active Dec 29, 2015
Get a random newspaper article from the Trove API.
View trove-random-article.js
$(function(){
var trove_api_key = "Your API key"; // Add your API key
var trove_api_url = "http://api.trove.nla.gov.au/result?zone=newspaper";
var start_year = 1803;
var end_year = 1954;
var current_year = 0;
function get_random_article() {
current_year = get_random_year(); // Get a random year first to limit the query size
var query = trove_api_url + "&q=date:[" + current_year + " TO " + current_year + "]&n=0&l-category=Article&encoding=json&key=" + trove_api_key;
@wragge
wragge / trove-format-facets-d3.js
Created Dec 8, 2013
Get format facets from the Trove API and construct a JSON object structured like the sample data used in most of the d3.js examples. It should be possible to plug this in to many of the d3 demos, though I've only tried it so far with the treeview and sunburst. As used in Trove Zone Explorer -- http://dhistory.org/trove/zone-explorer/
View trove-format-facets-d3.js
$(function(){
var api_key = 'your api key';
function get_data() {
$.jsonp({
"callbackParameter": 'callback',
"url": "http://api.trove.nla.gov.au/result?q= &zone=book,article,collection,picture,map,music&facet=format&n=0&encoding=json&key=" + api_key,
"timeout": 20000,
"success": function(results) {
process_results(results);
@wragge
wragge / newspaper title words
Created Apr 20, 2014
Frequency of words in Australian newspaper titles from Trove
View newspaper title words
advertiser - 116
times - 67
advocate - 43
news - 41
herald - 40
australian - 39
chronicle - 38
gazette - 31
express - 29
guardian - 28
@wragge
wragge / abc_current_affairs_names
Last active Aug 29, 2015
Most frequent contributors to ABC Radio current affairs programs AM, PM and The World Today from 1999-2014. Extracted from Radio National program data harvested from Trove.
View abc_current_affairs_names
Mark Colvin: 39087
Chris Uhlmann: 29182
Eleanor Hall: 23280
Linda Mottram: 11304
Alexandra Kirk: 3878
Alison Caldwell: 2269
Peter Ryan: 2142
Mark Willacy: 2067
Sabra Lane: 1948
Stephen Long: 1830
@wragge
wragge / gist:449559365f9aafb4cb04
Created Nov 25, 2014
Code to produce the graph of daily newspapers in Trove at https://plot.ly/~wragge/20
View gist:449559365f9aafb4cb04
import requests
import time
import plotly.plotly as py
from plotly.graph_objs import *
from credentials import TROVE_API_KEY
py.sign_in("[your plotly id]", "[your plotly password]")
titles_url = 'http://api.trove.nla.gov.au/newspaper/titles?encoding=json&key={}'