Class: ActiveFacts::Metamodel::LinkFactType

Inherits:
FactType
  • Object
show all
Defined in:
lib/activefacts/vocabulary/metamodel.rb,
lib/activefacts/vocabulary/extensions.rb

Defined Under Namespace

Classes: ImplicitReading

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, #create_implicit_fact_type_for_unary, #describe, #implicit_boolean_type, #internal_presence_constraints, #is_existential, #preferred_reading, #reading_preferably_starting_with_role

Instance Method Details

#add_reading(implicit_reading) ⇒ Object



845
846
847
848
# File 'lib/activefacts/vocabulary/extensions.rb', line 845

def add_reading implicit_reading
	@readings ||= []
	@readings << implicit_reading
end

#all_readingObject



850
851
852
853
854
855
856
857
# File 'lib/activefacts/vocabulary/extensions.rb', line 850

def all_reading
  @readings ||=
	  [ ImplicitReading.new(
 self,
 implying_role.fact_type.entity_type ? "{0} involves {1}" : implying_role.fact_type.default_reading+" Boolean"
	    )
	  ]
end

#default_readingObject



835
836
837
838
839
840
841
842
843
# File 'lib/activefacts/vocabulary/extensions.rb', line 835

def default_reading
  # There are two cases, where role is in a unary fact type, and where the fact type is objectified
  # If a unary fact type is objectified, only the LinkFactType for the objectification is asserted
  if objectification = implying_role.fact_type.entity_type
    "#{objectification.name} involves #{implying_role.object_type.name}"
  else
    implying_role.fact_type.default_reading+" Boolean"  # Must be a unary FT
  end
end