W3C home > Mailing lists > Public > public-rdf-ruby@w3.org > September 2010

spira modeling

From: Dominic Sisneros <dsisnero@gmail.com>
Date: Fri, 24 Sep 2010 02:32:18 -0600
Message-ID: <AANLkTimmVdYvnAnjraR-1Y3rYZMHGpxq=3K0d7N_44si@mail.gmail.com>
To: public-rdf-ruby@w3.org
When I try to self reference a type I get the following error:

..0.8/lib/spira/resource/dsl.rb:243:in `add_accessors': Unrecognized type:
Project (TypeError)

A code example is as below

class Person

  include Spira::Resource

  base_uri "http://example.org/example/people"

  property :name, :predicate => FOAF.name, :type => String
  property :age,  :predicate => FOAF.age,  :type => Integer

end

class Project
  include Spira::Resource

  type PM['Project']

  base_uri "http://example.org/example/projects"

  property :name, :predicate => PM.name, :type => String


  property :parent, :predicate => PM.subProjectOf, :type =>:project
  has_many :children, :predicate => PM.subProject, :type =>:project

end

bob = RDF::URI("http://example.org/people/bob").as(Person)
bob.age  = 15
bob.name = "Bob Smith"
bob.save!

project = Project.new
project.name = 'A new project'
project.assigned_to = bob
project.save!

project2 = Project.new
project2.name = 'a subproject'
project2.parent = project
project2.save!

Is this possible and how would I do it?

thanks
Received on Friday, 24 September 2010 15:56:01 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Friday, 24 September 2010 15:56:01 GMT