Sha256: e16b8bc78aa3768695087fff0314da936b0361e432572e2657d5a50f206be11d

Contents?: true

Size: 1.68 KB

Versions: 4

Compression:

Stored size: 1.68 KB

Contents

require 'activefacts/api'

module ::OneRoleNesting

  class AccuracyLevel < SignedInteger
    value_type :length => 32
    one_to_one :accuracy, :restrict => 1..5     # See Accuracy.accuracy_level
  end

  class PartyId < AutoCounter
    value_type 
    one_to_one :party                           # See Party.party_id
  end

  class PartyName < String
    value_type 
  end

  class Ymd < Date
    value_type 
    one_to_one :event_date                      # See EventDate.ymd
  end

  class Accuracy
    identified_by :accuracy_level
    one_to_one :accuracy_level, :mandatory => true  # See AccuracyLevel.accuracy
  end

  class EventDate
    identified_by :ymd
    one_to_one :ymd, :mandatory => true         # See ymd.event_date
  end

  class Party
    identified_by :party_id
    one_to_one :party_id, :mandatory => true    # See PartyId.party
  end

  class PartyMoniker
    identified_by :party
    one_to_one :party, :mandatory => true       # See Party.party_moniker
    has_one :party_name, :mandatory => true     # See PartyName.all_party_moniker
    has_one :accuracy, :mandatory => true       # See Accuracy.all_party_moniker
  end

  class Person < Party
    maybe :died
  end

  class Birth
    identified_by :person
    has_one :event_date, :mandatory => true     # See EventDate.all_birth
    one_to_one :person, :mandatory => true      # See Person.birth
    has_one :attending_doctor, :class => "Doctor"  # See Doctor.all_birth_as_attending_doctor
  end

  class Death
    identified_by :person
    one_to_one :person, :mandatory => true      # See Person.death
    has_one :death_event_date, :class => EventDate  # See EventDate.all_death_as_death_event_date
  end

  class Doctor < Person
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
activefacts-examples-1.9.8 ruby/OneRoleNesting.rb
activefacts-examples-1.8.0 ruby/OneRoleNesting.rb
activefacts-examples-1.7.2 ruby/OneRoleNesting.rb
activefacts-examples-1.7.1 ruby/OneRoleNesting.rb