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
# 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
# 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
#!/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' |
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
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
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
#!/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
# 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
require 'spira' | |
Spira.add_repository(:person, ::RDF::Repository) | |
class Person | |
include Spira::Resource | |
default_source :person |