Skip to content

Instantly share code, notes, and snippets.

View adamml's full-sized avatar

Adam Leadbetter adamml

View GitHub Profile
@adamml
adamml / SeaVoX Ports to OS Map
Created April 14, 2014 10:52
Get the mapping between the SeaVoX Ports Gazetteer and the Ordnance Survey Linked Data store (run against http://vocab.nerc.ac.uk/sparql/)
PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
PREFIX owl:<http://www.w3.org/2002/07/owl#>
select * where
{
<http://vocab.nerc.ac.uk/collection/C38/current/> skos:member ?a.
?a skos:prefLabel ?c.
?a owl:sameAs ?b
FILTER REGEX(str(?b), "ordnancesurvey")
}
@adamml
adamml / SKOS XML and JSON-LD mix
Created April 15, 2014 08:14
A proposal for WMO C3 code list format to be served from the NVS - note the SKOS XML and JSON-LD mix
<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
xmlns:dc="http://purl.org/dc/terms/"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:void="http://rdfs.org/ns/void#">
<skos:Concept rdf:about="http://vocab.nerc.ac.uk/collection/W03/current/001/">
<skos:prefLabel xml:lang="en">Sippican T-4</skos:prefLabel>
@adamml
adamml / time_eg.xml
Created June 11, 2014 18:51
Time Entity Example
<?xml version="1.0"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:geo="http://www.opengis.net/ont/geosparql#" xmlns:op="http://environment.data.gov.au/def/op#" xmlns:om="http://def.seegrid.csiro.au/isotc211/iso19156/2011/observation#" xmlns:prov="http://www.w3.org/ns/prov#" xmlns:qudt="http://qudt.org/schema/qudt#" xmlns:sf="http://www.opengis.net/ont/sf#" xmlns:skos="http://www.w3.org/2004/02/skos/core#" xmlns:time="http://www.w3.org/2006/time#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
<rdf:Description rdf:about="http://linked.bodc.ac.uk/series/952050">
<time:TemporalEntity rdf:resource="http://linked.bodc.ac.uk/series/952050#time"></time:TemporalEntity>
</rdf:Description>
<time:TemporalEntity rdf:about="http://linked.bodc.ac.uk/series/952050#time">
<time:hasBeginning rdf:resource="http://linked.bodc.ac.uk/series/952050#timeBegins"></time:hasBeginning>
<time:hasEnd rdf:resource
@adamml
adamml / smackdown_outcome.ttl
Created June 13, 2014 14:46
PROV / O&M / ODO mix
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix dcterms: <http://www.purl.org/dc/terms/>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
@prefix obs: <http://def.seegrid.csiro.au/isotc211/iso19156/2011/observation#>.
@prefix prov: <http://www.w3.org/ns/prov#>.
@prefix obs-prop: <http://environment.data.gov.au/def/op#>.
@prefix dcat: <http://www.w3.org/ns/dcat#>.
@prefix arpfo: <http://vocab.ox.ac.uk/projectfunding#>.
#
# Note - R2R (for example) may replace ODO with OceanLink (or GeoLink)
@adamml
adamml / bulletin.r
Created April 7, 2016 13:54
Observatory bulletin for Jupyter
#install.packages("RCassandra", repos="http://ftp.heanet.ie/mirrors/cran.r-project.org/")
library(RCassandra)
#Function to make sure we're dealing with a month and
#year for which we have data
fixMonthYear <- function(year,month){
nowDate <- Sys.Date()
nowYear <- strtoi(substr(nowDate,1,4))
nowMonth <- strtoi(substr(nowDate,6,7))
@adamml
adamml / argoDataCollector.go
Created May 27, 2016 13:58
Argo data collector
// miDataCollectorArgo
package main
import (
"fmt"
"os"
"io/ioutil"
"encoding/json"
"strings"
"strconv"
@adamml
adamml / nvs_emodnet_chem.rq
Last active July 14, 2016 11:21
EMODnet chemistry mappings from the NERC Vocabulary Server
PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT ?P36 ?P35 ?P01 ?P03
WHERE {
<http://vocab.nerc.ac.uk/collection/P36/current/> rdf:type skos:Collection.
<http://vocab.nerc.ac.uk/collection/P36/current/> ?o ?p.
?s skos:member ?p.
?p skos:prefLabel ?P36.
?p skos:narrower ?c.
<http://vocab.nerc.ac.uk/collection/P35/current/> skos:member ?c.
@adamml
adamml / Examples
Last active July 29, 2016 11:06
Grok patterns for oceanographic instrumentation
#Spiddal CTD output
%{MI_PREFIX}%{SPACE}%{IDRONAUT_OCEAN7_304}
#Spiddal Fluorometer
%{MI_PREFIX}%{WETLABS_ECO_FLNTU_3137}
@adamml
adamml / eg.tex
Created August 19, 2016 14:48
LaTeX list style for Grok syntax highlighting
\lstdefinelanguage{Grok}{
keywords={NUMBER, SPACE, TIME, MONTHNUM,MONTHDAY,TIMESTAMP_ISO8601,INT,MI_INST,MI_PREFIX,IDRONAUT_OCEAN7_304,WETLABS_ECO_FLNTU_3137},
keywordstyle=\color{blue}\bfseries,
ndkeywords={float, time, integer, timestamp},
ndkeywordstyle=\color{green}\bfseries,
comment=[l]{\#},
commentstyle=\color{purple}\ttfamily,
identifierstyle=\color{red}\ttfamily,
}