-
Notifications
You must be signed in to change notification settings - Fork 1
Home
kangguru edited this page Sep 13, 2010
·
3 revisions
semantic_record is designed to use data that is stored in an sesame triple-store whitin an rails application. So usage an behavior are highly similar to activerecord.
A simple model implementation would look like:
class Genre < SemanticRecord::Base
self.base = "http://example.org" # for setting the base URI
self.uri = "http://example.org/music#Musicgenre" # for overriding guessing from classname and base
def some-method
end
end
You can use find to access instances of the given class:
g = Genre.find # gets all instances g = Genre.new('http://example.org/music#Funk') # gets an specific instance
Also dynamic finders are avaliable on datatype properties:
class Genre < SemanticRecord::Base
g = Genre.find_by_artist('John Doo')