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 'quantity/all' | |
1.meter #=> 1 meter | |
1.meter.to_feet #=> 3.28083... foot | |
c = 299792458.meters / 1.second #=> 299792458 meter/second | |
newton = 1.meter * 1.kilogram / 1.second**2 #=> 1 meter*kilogram/second^2 | |
newton.to_feet #=> 3.28083989501312 foot*kilogram/second^2 | |
newton.convert(:feet) #=> 3.28083989501312 foot*kilogram/second^2 | |
jerk_newton / 1.second #=> 1 meter*kilogram/second^3 | |
jerk_newton * 1.second == newton #=> true |
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 'spira' | |
require 'rdf' | |
Spira.add_repository(:person, ::RDF::Repository) | |
class Person | |
include Spira::Resource |
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 CDs < RDF::Vocabulary('http://example.org/') | |
property :artist | |
property :cds | |
property :artists | |
end | |
class CD | |
include Spira::Resource |
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 'spira' | |
Spira.add_repository(:person, ::RDF::Repository) | |
class Person | |
include Spira::Resource | |
default_source :person |
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
# sample heroku rackup | |
http://rdfdo.heroku.com/postgres | |
http://rdfdo.heroku.com/sqlite3 | |
$:.unshift(Dir.glob("./.bundle/gems/bundler/gems/rdf-spec*gemspec*/lib").first) | |
require 'spec' | |
app = proc do |env| |
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 ruby | |
require 'rdf' | |
require 'do_sqlite3' | |
require 'rdf/do' | |
$:.unshift '~/repos/RDFObjects/lib' | |
require 'rdf_objects' | |
rdfobject = RDFObject::Resource.new('http://example.org/1234') |
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
RSpec: | |
should support #predicates | |
200 OK | text/plain 1070 bytes | |
200 OK | text/plain 1070 bytes | |
200 OK | text/plain 1070 bytes | |
200 OK | text/plain 1070 bytes | |
200 OK | text/plain 1070 bytes | |
200 OK | text/plain 1070 bytes | |
200 OK | text/plain 1070 bytes |
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:rdf ben$ irb | |
>> require 'rdf' | |
=> true | |
>> s = RDF::NTriples.unserialize '<http://openlibrary.org/b/OL3M> <http://RDVocab.info/Elements/titleProper> "Jhūlā." ' | |
=> #<RDF::Statement:0x90bbb8(<http://openlibrary.org/b/OL3M> <http://RDVocab.info/Elements/titleProper> "Jhūlā." .)> | |
>> RDF::NTriples.serialize(s) | |
=> "<http://openlibrary.org/b/OL3M> <http://RDVocab.info/Elements/titleProper> "Jh\305\253l\304\201." .\n" | |
>> exit |
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 'spira' | |
require 'rdf/ntriples' | |
class Person | |
include Spira::Resource | |
property :name, :predicate => FOAF.name | |
property :nick, :predicate => FOAF.nick | |
end |
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 jruby | |
libs = %w{jena-2.6.2 arq-2.8.3 icu4j-3.4.4 iri-0.8 log4j-1.2.14 stax-api-1.0.1 wstx-asl-3.2.9 xercesImpl-2.7.1 slf4j-api-1.5.8 slf4j-log4j12-1.5.8} | |
libdir = "/Users/ben/jena/ARQ-2.8.3/lib" | |
libs.each do | lib | | |
require File.join(libdir, "#{lib}.jar") | |
end | |
require '/Users/ben/jena/spinrdf-1.1.1/lib/spinrdf-1.1.1.jar' | |
require 'rdf' |
OlderNewer