Skip to content

Instantly share code, notes, and snippets.

@kwijibo
kwijibo / x
Created April 28, 2009 16:59
morph current document url
function absolutifyUrls(data, sourceUrl) {
var relRe = /:\/\//;
var domainRe = /.*?\/\/[^?/]*/;
var pathRe = /.*\//;
if (sourceUrl.length-sourceUrl.replace(/\//g,"").length==2) {
sourceUrl += "/";
}
if (typeof(data)=="string") {
data = jQuery("<div>"+data+"</div>");
} else if (typeof(data)=="object") {
@kwijibo
kwijibo / x
Created April 28, 2009 17:01
prefix.cc lookup ubiquity command
CmdUtils.CreateCommand({
name: "prefix",
takes: {"term": noun_arb_text},
homepage: "http://kwijibo.talis.com/",
author: { name: "Keith Alexander", email: "keith.alexander@talis.com"},
license: "MPL",
description: "performs a lookup on prefix.cc (http://prefix.cc/)",
preview: function(previewBlock, term) {
previewBlock.innerHTML = "looking up " + term.text ;
@kwijibo
kwijibo / x
Created April 28, 2009 17:09
schemacache lookup ubiquity command
CmdUtils.CreateCommand({
name: "schemacache",
takes: {"term": noun_arb_text},
homepage: "http://schemacache.com/",
author: { name: "Keith Alexander", email: "keith.alexander@talis.com"},
license: "MPL",
description: "performs a lookup on SchemaCache (http://schemacache.com)",
preview: function(previewBlock, term) {
previewBlock.innerHTML = "Looking up " + term.text + " at SchemaCache ... ";
CmdUtils.CreateCommand({
name: "openvocab-property",
takes: {"term": noun_arb_text},
homepage: "http://kwijibo.talis.com/",
author: { name: "Keith Alexander", email: "keith.alexander@talis.com"},
license: "MPL",
description: "Brings up the form to edit or create a property named after the selected or inputed text on http://open.vocab.org. nb: propertiesmost be lower case",
buildUrl: function(term){
var uri = "http://open.vocab.org/terms/"+term.text.replace('/ /g', '');
@kwijibo
kwijibo / x
Created November 3, 2009 13:25
/* This is a template command. */
CmdUtils.CreateCommand({
name: "show sparql query",
icon: "http://swik.net/swikIcons/img-228-96x96.jpg",
homepage: "http://kwijibo.talis.com/",
author: {name: "Keith Alexander", email: "kwijibo@talis.com"},
license: "GPL",
description: "Showw the sparql query from the current url",
help: "How to use your command",
takes: {"input": /.*/},
@kwijibo
kwijibo / gist:718313
Created November 27, 2010 21:51
Add missing prefixes to SPARQL query in active textarea
(function(){
var mappings = {
"foaf": "http:\/\/xmlns.com\/foaf\/0.1\/",
"dc": "http:\/\/purl.org\/dc\/terms\/",
"rdf": "http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#",
"rdfs": "http:\/\/www.w3.org\/2000\/01\/rdf-schema#",
"owl": "http:\/\/www.w3.org\/2002\/07\/owl#",
"geonames": "http:\/\/www.geonames.org\/ontology#",
"geo": "http:\/\/www.w3.org\/2003\/01\/geo\/wgs84_pos#",
"skos": "http:\/\/www.w3.org\/2004\/02\/skos\/core#",
@kwijibo
kwijibo / voiDtoLDA.php
Created January 17, 2011 19:16
command line script that takes a voiD Dataset URI and generates a Linked Data API config file
<?php
define('DCT_DESCRIPTION', 'http://purl.org/dc/terms/description');
define('MORIARTY_ARC_DIR', 'arc/');
define('MORIARTY_ALWAYS_CACHE_EVERYTHING', 'cache');
define('MORIARTY_HTTP_CACHE_DIR', 'cache');
define('VOID_NS', 'http://rdfs.org/ns/void#');
define('VOID_SPARQL', VOID_NS.'sparqlEndpoint');
define('VOID_EXAMPLE', VOID_NS.'exampleResource');
define('API','http://purl.org/linked-data/api/vocab#' );
@kwijibo
kwijibo / VoID_to_LDA_script.php
Created August 24, 2011 11:21
converts VoID to Linked Data API Config
<?php
define('DCT_DESCRIPTION', 'http://purl.org/dc/terms/description');
define('MORIARTY_ARC_DIR', 'arc/');
define('MORIARTY_ALWAYS_CACHE_EVERYTHING', 'cache');
define('MORIARTY_HTTP_CACHE_DIR', 'cache');
define('VOID_NS', 'http://rdfs.org/ns/void#');
define('VOID_SPARQL', VOID_NS.'sparqlEndpoint');
define('VOID_EXAMPLE', VOID_NS.'exampleResource');
define('API','http://purl.org/linked-data/api/vocab#' );
@kwijibo
kwijibo / sns stats json sample.json
Created September 4, 2011 00:38
sample of SNS data expressed as json - this uses URIs as identifiers but is not rdf
{
"http:\/\/linkedscotland.org\/def\/percentage_of_households_within_0_30_minutes_drive_time_of_a_college_of_higher_or_further_education": {
"http:\/\/reference.data.gov.uk\/id\/year\/2001": {
"http:\/\/linkedscotland.org\/id\/geography\/local-authority\/100": "100",
"http:\/\/linkedscotland.org\/id\/geography\/local-authority\/110": "52.6",
"http:\/\/linkedscotland.org\/id\/geography\/local-authority\/120": "95.6",
"http:\/\/linkedscotland.org\/id\/geography\/local-authority\/130": "13.4",
"http:\/\/linkedscotland.org\/id\/geography\/local-authority\/150": "100",
"http:\/\/linkedscotland.org\/id\/geography\/local-authority\/170": "54.7",
"http:\/\/linkedscotland.org\/id\/geography\/local-authority\/180": "100",
@kwijibo
kwijibo / simple.xml
Created September 4, 2011 08:50
sample xml output from linked data api
<?xml version="1.0" encoding="utf-8"?>
<result format="linked-data-api" version="0.2" href="http://linkedscotland.org/doc/concepts/sns/registered_blind_sns_upload_2005.xml">
<primaryTopic href="http://linkedscotland.org/concepts/sns/registered_blind_sns_upload_2005">
<scheme href="http://linkedscotland.org/concepts/sns/"/>
<label xml:lang="en-gb">Registered Blind SNS Upload 2005</label>
<type href="http://www.w3.org/2004/02/skos/core#Concept"/>
<isTopicOf>
<item href="http://linkedscotland.org/id/dataset/CA-NRPS515pop05"/>
<item href="http://linkedscotland.org/id/dataset/CA-NRB51505"/>
<item href="http://linkedscotland.org/id/dataset/CA-blindtotpop05"/>