Skip to content

Instantly share code, notes, and snippets.

@bhuga
Created April 20, 2010 21:14
Show Gist options
  • Save bhuga/373085 to your computer and use it in GitHub Desktop.
Save bhuga/373085 to your computer and use it in GitHub Desktop.
require 'spira'
require 'rdf/ntriples'
class Person
include Spira::Resource
property :name, :predicate => FOAF.name
property :nick, :predicate => FOAF.nick
end
repository = RDF::Repository.load('http://datagraph.org/jhacker/foaf.nt')
Spira.add_repository(:default, repository)
Person.repository.object_id == repository.object_id
# => true
jhacker = Person.create('http://datagraph.org/jhacker/#self')
jhacker.save!
# Error, or equivalent to find?
jhacker = Person.create('http://datagraph.org/jhacker/#self', :nick => "some new nick, different than what's in the repository")
jhacker.save!
# Error, or equivalent to find and setting the nick?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment