Skip to content

Instantly share code, notes, and snippets.

View niklasl's full-sized avatar

Niklas Lindström niklasl

View GitHub Profile
@niklasl
niklasl / schemabibex-examples-dcterms.ttl
Created July 16, 2013 12:29
Using the Dublin Core terms isFormatOf and isVersionOf to interlink some SchemaBibEx examples
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix dc: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix pto: <http://www.productontology.org/id/> .
@prefix : <http://schema.org/> .
## Altered parts of <http://www.oclc.org/content/dam/research/publications/library/2013/2013-05.pdf> ##
@niklasl
niklasl / pres.mkd
Created January 10, 2013 21:41
Scripting Vim - From Moves to Tools [A Vim Presentation]

Scripting Vim - From Moves to Tools

  • Customizing Vim
  • Mappings
  • Commands
  • Batching with Vim
  • Case: plugin

@niklasl
niklasl / rdfa_prototypes.html
Created December 9, 2012 08:52
HTML5+RDFa version of <http://d.lib.ncsu.edu/collections/catalog/mc00096-001-ff0155-000-001_0001> using experimental RDFa prototypes
<!DOCTYPE html>
<html>
<head>
<base href="http://d.lib.ncsu.edu/collections/catalog/mc00096-001-ff0155-000-001_0001" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width; initial-scale=1.0">
<html>
<head>
<meta charset="utf-8"/>
<title>Dynamics of Intraocular IFN-?, IL-17 and IL-10-Producing Cell Populations during Relapsing and Monophasic Rat Experimental Autoimmune Uveitis.</title>
<link rel="alternate" href="http://dx.doi.org/10.1371/journal.pone.0049008"/>
<link rel="canonical" href="http://pubmed.gov/23155443"/>
</head>
<body>
<article resource="info:pmid:23155443" vocab="http://schema.org/" typeof="MedicalScholarlyArticle">
<header><h1 property="name"><a property="url" href="http://pubmed.gov/23155443">Dynamics of Intraocular ...</a></h1>
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body vocab="http://schema.org/">
<div resource="_:TShirtModel">
<div property="owl:unionOf" inlist typeof>
<link property="owl:onProperty" resource="schema:name"/>
#!/bin/bash
if [[ $# -lt 1 ]]; then
echo "Usage: $(basename $0) [pause|play|next track|previous track|set sound volume to [0-100]] [HOST]"
exit 0
fi
action=$1
host=$2
cmd="osascript -e 'tell application \"iTunes\" to $action'"
@niklasl
niklasl / context.json
Created July 4, 2012 08:53
ORE description of an issue as JSON-LD
{
"@context": {
"uri": "@id",
"type": "@type",
"xsd": "http://www.w3.org/2001/XMLSchema#",
"dc": "http://purl.org/dc/terms/",
"ore": "http://www.openarchives.org/ore/terms/",
"bibo": "http://purl.org/ontology/bibo/",
"name": {"@id": "http://www.w3.org/2000/01/rdf-schema#label", "@language": "en"},
"created": {"@id": "dc:created", "@type": "xsd:dateTime"},
@niklasl
niklasl / rdf_vocab_to_jsonld_context.py
Created May 22, 2012 16:41
Generating a JSON-LD context from an RDF vocabulary
import sys
from rdflib import *
fpath = sys.argv[1]
prefix = sys.argv[2]
g = Graph().parse(fpath, format='n3' if fpath.endswith(('.n3', '.ttl')) else 'xml')
def name_pair(item):
qname = item.qname()
@niklasl
niklasl / validate_curie_pattern.py
Created April 27, 2012 07:31
Validate CURIE regexp patterns
import re
valid_curies = [
"pfx:abc",
":",
"pfx:",
"abc",
":abc",
"",
"pfx:/abc",
@niklasl
niklasl / students-jumping-in-front-of-memorial-bell-tower.html
Created February 9, 2012 00:16
An HTML5+RDFa1.1 version of an example article by Jason Ronallo
<!-- An RDFa 1.1 version of the data presented in the article
"HTML5 Microdata and Schema.org" at
<http://journal.code4lib.org/articles/6400>.
The article is licensed under a Creative Commons Attribution 3.0 United
States License. This example code should be consired a remix thereof. -->
<div id="main" role="main" class="container_12" vocab="http://schema.org/" resource="" typeof="ItemPage">
<h2 id="page_name" property="name">
Students jumping in front of Memorial Bell Tower
</h2>
<div class="grid_5" resource="http://www.freebase.com/m/026twjv">