Skip to content

Instantly share code, notes, and snippets.

View ryankohl's full-sized avatar

Ryan Kohl ryankohl

  • POLITICO
  • Maryland
View GitHub Profile
@ryankohl
ryankohl / gist:947772
Created April 29, 2011 03:04
NHL Play-by-Play Analysis
(ns nhl.analysis
(:use [seabass core] )
(:use [incanter core stats charts] ))
(defn get-data[ n m] (map #(str "data/file-" % ".nt") (range n (+ 1 m))))
(defn get-model [n m] (apply build (get-data n m)))
(def ont "files/ontology.ttl")
(def rules "files/nhl.rules")
@ryankohl
ryankohl / gist:945621
Created April 28, 2011 01:36
Transform of NHL Json data into RDF N-TRIPLES
(ns nhl.parse
(:require [clojure.string]
[clojure.contrib [json :as json]] ))
(defn nope? [x] (or (= "" x) (= nil x)))
(defn blank [id] (str "_:b" @id) )
(defn node [namespace id] (if-not (or (nope? namespace) (nope? id)) (str "<" namespace id ">") ))
(defn str-lit [val] (if-not (nope? val) (str \" val \") ))
(defn int-lit [val] (if-not (nope? val) (str \" val \" "^^<http://www.w3.org/2001/XMLSchema#integer>") ))
(defn date-lit [val] (if-not (nope? val) (str \" val \" "^^<http://www.w3.org/2001/XMLSchema#date>") ))