This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def *levenshtein* (org.tiling.misspelling.metric.LevenshteinDistanceMetric.)) | |
(defn levenshtein-metric | |
([a b] | |
(let [total (+ (count a) (count b)) | |
lev-value (.distance *levenshtein* a b)] | |
(- 1 (/ (double lev-value) (double total)))))) | |
(defn introduce-blanks | |
([b w] (.replace w b " "))) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.testExport1 = function(test) { | |
Store.create(function(store) { | |
store.load('remote', 'http://dbpedia.org/resource/Tim_Berners-Lee', 'http://test.com/graph-to-export', | |
function(success, result) { | |
var graph = store.graph('http://test.com/graph-to-export', function(success, graph){ | |
var n3 = ""; | |
graph.forEach(function(triple) { | |
n3 = n3 + triple.toString(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.testExport1 = function(test) { | |
Store.create(function(store) { | |
store.load('remote', 'http://dbpedia.org/resource/Tim_Berners-Lee', 'http://test.com/graph-to-export', | |
function(success, result) { | |
store.graph('http://test.com/graph-to-export', function(success, graph){ | |
var n3 = ""; | |
graph.forEach(function(triple) { | |
n3 = n3 + triple.toString(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var rdfstore = require('./dist/nodejs/index.js'); | |
rdfstore.create(function(store){ | |
store.execute('LOAD <http://dbpedia.org/resource/Tim_Berners-Lee> INTO GRAPH <http://example.org/people>', function() { | |
store.setPrefix('dbp', 'http://dbpedia.org/resource/'); | |
store.node(store.rdf.resolve('dbp:Tim_Berners-Lee'), "http://example.org/people", function(success, graph) { | |
var peopleGraph = graph.filter(store.rdf.filters.type(store.rdf.resolve("foaf:Person"))); | |
console.log(peopleGraph); | |
store.execute('PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var https = require('https'); | |
var http = require('http'); | |
var util = require('util'); | |
var fs = require('fs'); | |
var url = require('url'); | |
var raptor = require('./raptor.js'); | |
var rdfstore = require('./rdfstore.js'); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Store.create(function(store){ | |
var graph = new store.rdf.createGraph(); | |
store.rdf.setPrefix("earl", "http://www.w3.org/ns/earl#"); | |
store.rdf.setDefaultPrefix("http://www.w3.org/ns/earl#") | |
store.rdf.setPrefix("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); | |
graph.add(store.rdf.createTriple( store.rdf.createNamedNode("earl:test"), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class='MicroblogPost Post row' about='{{@subject}}' typeof='sioc:MicroblogPost'> | |
<div class='header row'> | |
<span class='creator' rel='sioc:has_creator'> | |
<span typeof='sioc:UserAccount'> | |
{{#sioc:has_creator}} | |
<span rel='sioc:avatar'><img src='{{sioc:avatar}}'></img></span> | |
<span property='sioc:name'>{{sioc:name}}</span> | |
<a target='_blank' class='webid-link' rel='sioc:accountOf' href='{{sioc:accountOf}}'>webid</a> | |
{{/sioc:has_creator}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mg = require('./../src/micrograph'); | |
exports.inverseProperties = function(test) { | |
mg.create(function(g) { | |
// saving a Person | |
g.save([{$type: 'Person', | |
name: 'Ludwig', | |
surname: 'Wittgenstein', | |
birthplace: 'Wien'}], | |
function(wittgenstein){ | |
// saving some books |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mg.create(function(g) { | |
g.define('Commit', {color: 'orange', | |
radius: function(){ return 5 }, | |
opacity: 0.8}) | |
.define('Person', {color: 'lightBlue', | |
committed: function(){ return (this.author$in.length ? this.author$in : [this.author$in]); }, | |
radius: function(){ return 30+(5*this.committed().length) }, | |
opacity: 0.3}) | |
.from("https://api.github.com/repos/"+user+"/"+project+"/commits?callback=loadCommits&per_page=100") | |
.transform(function(prop,obj) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; The script assumes you are using bash. | |
;; | |
;; You can run any of these commands from a buffer visiting a file within a Ruby project: | |
;; | |
;; cap-tasks -> lists all capistrano tasks | |
;; cap-deploy | |
;; cap -> asks the user the name of a task and executes it, asking for more input if it detects | |
;; capistrano is outputing something finished with ':' (like Password:). | |
(defun chomp (str) | |
"Chomp leading and tailing whitespace from STR." |