Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓

Leigh Dodds ldodds

🤓
View GitHub Profile
View gist:443400
<http://data.gov.uk/dataset/revenue-based_taxes_and_benefits_-_tax_receipts_and_taxpayers_-_table_13_receipts_of_taxes_updated_m> <http://purl.org/dc/terms/description> """Provides monthly and quarterly information on all HMRC taxes, including tax receipts, the number of taxpayers, personal tax credits, child benefit and estimates of the cost of tax expenditures and structural relief.
Source agency: HM Revenue and Customs
Designation: National Statistics
Language: English
Alternative title: Revenue Based Taxes""".
View gist:450684
</processor>
a api:Processor.
<linked-data-api.xml>
a api:Page ;
dct:format ... (etc)
api:wasResultOf [
a api:Formatting ;
api:formatter <...>;
View gist:451993
</processor>
a api:Processor;
api:configuration <...>.
<linked-data-api.xml>
a api:Page ;
dc:format .. (etc);
api:wasResultOf [
a api:Execution
View prelinger.rb
require 'rubygems'
require 'open-uri'
require 'json'
SEARCH = "(collection:prelinger+OR+mediatype:prelinger)+AND+-mediatype:collection"
ALL_FIELDS = "&fl[]=avg_rating&fl[]=call_number&fl[]=collection&fl[]=contributor&fl[]=coverage&fl[]=creator&fl[]=date&fl[]=description&fl[]=downloads&fl[]=foldoutcount&fl[]=format&fl[]=headerImage&fl[]=identifier&fl[]=imagecount&fl[]=language&fl[]=licenseurl&fl[]=mediatype&fl[]=month&fl[]=num_reviews&fl[]=oai_updatedate&fl[]=publicdate&fl[]=publisher&fl[]=rights&fl[]=scanningcentre&fl[]=source&fl[]=subject&fl[]=title&fl[]=type&fl[]=volume&fl[]=week&fl[]=year"
ID_FIELD_ONLY = "&fl[]=identifier"
def mkdirs()
@ldodds
ldodds / gist:1231779
Created Sep 21, 2011
Annotation query
View gist:1231779
SELECT * WHERE {
?annotation a a:Annotation;
a:body ?body;
a:annotates <http://www.gac.culture.gov.uk/images/standard/17686.jpg>;
arthack:top ?top;
arthack:left ?left;
arthack:height ?height;
arthack:width ?width.
@ldodds
ldodds / demo.py
Created Oct 26, 2011
Searching a dataset in Kasabi
View demo.py
import pytassium
import time
dataset = pytassium.Dataset('nasa','put-your-api-key-here')
# --------------------------
# Use the lookup API
# --------------------------
response, data = dataset.lookup('http://data.kasabi.com/dataset/nasa/person/eugeneandrewcernan')
if response.status in range(200,300):
# data now contains an rdflib.Graph
@ldodds
ldodds / bulk_load.rb
Created Mar 30, 2012
Example of Bulk load Ntriples into Kasabi using kasabi.rb
View bulk_load.rb
# Bulk load N-Triples into Kasabi
#
# Simple script to iterate through a large n-triples file and load it into Kasabi
#
# Be sure to set two environment variables: KASABI_DATASET and KASABI_API_KEY
#
# Script accepts a single command-line parameter which is the location of the file to upload
require 'rubygems'
require 'kasabi'
View spiderman.ttl
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rel: <http://www.perceive.net/schemas/relationship/> .
<http://example.org/#green-goblin>
rel:enemyOf <http://example.org/#spiderman> ;
a foaf:Person ;
foaf:name "Green Goblin" .
@ldodds
ldodds / touche.ttl
Created Mar 30, 2012
Touche Turtle in Turtle
View touche.ttl
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rel: <http://www.perceive.net/schemas/relationship/> .
@prefix ex: <http://example.org/ns#>
<http://example.org/#touche-turtle>
rel:friendOf <http://example.org/#dum-dum> ;
a ex:Turtle ;
foaf:name "Touche Turtle" .
<http://example.org/#dum-dum>