Class: ActiveFacts::Metamodel::LinkFactType
- Defined in:
- lib/activefacts/metamodel/metamodel.rb,
lib/activefacts/metamodel/extensions.rb
Instance Attribute Summary
Attributes inherited from FactType
#check_and_add_spanning_uniqueness_constraint
Instance Method Summary collapse
Methods inherited from FactType
#all_reading_by_ordinal, #all_role_in_order, #compatible_readings, #default_reading, #describe, #internal_presence_constraints, #is_existential, #is_unary, #preferred_reading, #reading_preferably_starting_with_role
Instance Method Details
#all_reading ⇒ Object
1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 |
# File 'lib/activefacts/metamodel/extensions.rb', line 1383 def all_reading if super.size == 0 # No user-defined readings have been defined, so it's time to stop being lazy: objectification_role, mirror_role = *all_role_in_order preferred_role_ref = mirror_role.base_role.preferred_reference rs = constellation.RoleSequence(:new) rr0 = constellation.RoleRef(rs, 0, :role => objectification_role) rr1 = constellation.RoleRef(rs, 1, :role => mirror_role) rr1.leading_adjective = preferred_role_ref.leading_adjective rr1.trailing_adjective = preferred_role_ref.trailing_adjective r0 = constellation.Reading(self, 0, :role_sequence => rs, :text => "{0} involves {1}", :is_negative => false) # REVISIT: This assumes English! r1 = constellation.Reading(self, 1, :role_sequence => rs, :text => "{1} is involved in {0}", :is_negative => false) end @all_reading end |
#objectification_role ⇒ Object
1403 1404 1405 |
# File 'lib/activefacts/metamodel/extensions.rb', line 1403 def objectification_role (all_role.to_a-[.mirror_role_as_base_role])[0] end |