require 'rubygems' require 'active_rdf' # open an empty, in-memory RDFLite triple store adapter = ConnectionPool.add_data_source :type => :rdflite # alternatively to use redland: adapter = ConnectionPool.add_data_source :type => :redland # now load the test data file into the triple store adapter.load "./test_person_data.nt" # register the namespace, like above Namespace.register(:test, 'http://activerdf.org/test/') # construct the necessary Ruby Modules and Classes to use the Namespace ObjectManager.construct_classes # we want to access the properties of this URI eyal = TEST::Person.new 'http://activerdf.org/test/eyal' # now we can read the age associated with eyal puts eyal.age # prints "27" # lets try to write a new age eyal.age = 18 # if we now output the age again, there will be two values for it # because there is no way to decide which one is the real age # however, this behaviour might change in the future.. puts eyal.age # prints "18,27"