spira modeling

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 UTC