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
# Note that as in the SIOC reference documents, the extended SIOC types | |
# ontology is referred to as sioc_t. | |
It would seem that 'reference implementations' of existing ontologies are | |
actually quite difficult in Spira. | |
sioc:topic references an RDF Resource. That Resource may optionally be a | |
sioc_t:Category or sioc_t:Tag. sioc_t:Category is a subclass of skos.Concept, | |
but sioc_t:Tag is its own thing. |
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
# Demonstrates a JRuby difference with RDF enumerators | |
require 'rdf' | |
require 'rdf/ntriples' | |
include RDF | |
s = Statement.new(FOAF.age, FOAF.age, FOAF.age) | |
r = Repository.new | |
r.insert(s) |
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
#!/usr/bin/env ruby1.9 | |
# | |
$:.unshift('./lib') | |
require 'linkeddata/repository' | |
require 'spira' | |
repo = LinkedData::Repository.new | |
uri = RDF::URI('http://www.bbc.co.uk/programmes/b00jnwlc#programme') |
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
require 'promise' | |
four = promise { 2 + 2 } | |
puts "respond_to? :odd? #{four.respond_to?(:odd?)}" | |
# => true | |
puts "respond_to? :asdfsa? #{four.respond_to?(:asdfasdf?)}" | |
# => false |
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
#!/usr/bin/env ruby1.9 | |
require 'rdf' | |
require 'rdf/rdfxml' | |
require 'rdf/ntriples' | |
require 'rdf/isomorphic' | |
s1 = %(<?xml version="1.0"?> | |
<rdf:RDF xmlns: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
class ThreadTest | |
def initialize | |
# kicks off the thread, and only afterwards assigns thread to @t | |
@t = Thread.new { joiner } | |
end | |
def joiner | |
# without this sleep, will sometimes crash, | |
# as @t is not yet the thread, so will try to call @t.join on nil |
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
I hacked up methodmissing's promise to rename it to ExtPromise. Then I edited the benchmark program like so: | |
require "benchmark" | |
require "ext/promise/promise" | |
require "promise" | |
TESTS = 1000 | |
Benchmark.bmbm do |results| | |
# Picked inspect instead of undefined, as the pure-ruby promise will raise an | |
# exception on undefined instead of return the promise value |
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
ben:promising-future ben$ rake bench; rake1.9 bench; jrake bench | |
(in /Users/ben/Repos/promising-future) | |
Rehearsal ---------------------------------------------------------- | |
Nothing 0.000000 0.000000 0.000000 ( 0.004472) | |
Nothing(Promise) 0.010000 0.000000 0.010000 ( 0.009008) | |
Nothing(Future) 0.120000 0.050000 0.170000 ( 0.168207) | |
A method 0.000000 0.000000 0.000000 ( 0.005997) | |
A method(Promise) 0.010000 0.000000 0.010000 ( 0.012526) | |
A method(Future) 0.130000 0.040000 0.170000 ( 0.171445) | |
#== 0.000000 0.000000 0.000000 ( 0.004996) |
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
#!/usr/bin/env ruby1.9 | |
# local spira bug fix for bnode objects with Types::Any | |
$:.unshift '~/repos/spira/lib' | |
require 'spira' | |
require 'rdf/n3' | |
require 'rdf/isomorphic' | |
DAWG = RDF::Vocabulary.new('http://www.w3.org/2001/sw/DataAccess/tests/test-dawg#') | |
MF = RDF::Vocabulary.new('http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#') | |
QT = RDF::Vocabulary.new('http://www.w3.org/2001/sw/DataAccess/tests/test-query#') |
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
root@ip-10-251-122-82:/home/lavender/spocq/src/test/rspec/tests/data-r2/i18n# curl http://tmp.datagraph.org.s3.amazonaws.com/import/33f361f0-d1b2-012d-f3cf-0023df827da6 > curl | |
% Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
113 795 113 795 0 0 47522 0 --:--:-- --:--:-- --:--:-- 56785 | |
root@ip-10-251-122-82:/home/lavender/spocq/src/test/rspec/tests/data-r2/i18n# diff curl normalization-01.ttl | |
root@ip-10-251-122-82:/home/lavender/spocq/src/test/rspec/tests/data-r2/i18n# ls -al curl normalization-01.ttl | |
-rw-r--r-- 1 root root 795 2010-11-14 00:21 curl | |
-rw-r--r-- 1 lavender lavender 795 2010-10-29 05:46 normalization-01.ttl | |
root@ip-10-251-122-82:/home/lavender/spocq/src/test/rspec/tests/data-r2/i18n# irb1.9 |