Skip to content

Instantly share code, notes, and snippets.

View ldodds's full-sized avatar
🤓

Leigh Dodds ldodds

🤓
View GitHub Profile
<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""".
</processor>
a api:Processor.
<linked-data-api.xml>
a api:Page ;
dct:format ... (etc)
api:wasResultOf [
a api:Formatting ;
api:formatter <...>;
</processor>
a api:Processor;
api:configuration <...>.
<linked-data-api.xml>
a api:Page ;
dc:format .. (etc);
api:wasResultOf [
a api:Execution
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:991384
Created May 25, 2011 17:08
This is a test
test
@ldodds
ldodds / gist:1231779
Created September 21, 2011 10:45
Annotation query
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 October 26, 2011 15:37
Searching a dataset in Kasabi
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 March 30, 2012 12:42
Example of Bulk load Ntriples into Kasabi using kasabi.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'
@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 March 30, 2012 16:25
Touche Turtle in Turtle
@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>