fca :: FormalConcept
A pair (A,B) is a formal concept of a FormalContext (G, M, I) provided that:
Equivalently and more intuitively, (A,B) is a formal concept precisely when:
fca :: FormalConcept :: attributes=
Concept attributesfca :: FormalConcept :: defaultinit
fca :: FormalConcept :: is_subconcept
Isself
a subconcept of super_concept
?
fca $ FormalConcept :: SELF
Type of this instance, automatically specialized in every classfca :: FormalConcept :: attributes=
Concept attributescore :: Object :: class_factory
Implementation used byget_class
to create the specific class.
fca :: FormalConcept :: defaultinit
core :: Object :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
fca :: FormalConcept :: is_subconcept
Isself
a subconcept of super_concept
?
core :: Object :: output_class_name
Display class name on stdout (debug only).
# Formal Concept
#
# A pair *(A,B)* is a formal concept of a FormalContext *(G, M, I)* provided that:
#
# * *A ⊆ G*,
# * *B ⊆ M*,
# * *A′ = B*, and
# * *B′ = A*.
#
# Equivalently and more intuitively, *(A,B)* is a formal concept precisely when:
#
# * every object in *A* has every attribute in *B*,
# * for every object in *G* that is not in *A*, there is some attribute in *B* that
# the object does not have,
# * for every attribute in *M* that is not in *B*, there is some object in *A*
# that does not have that attribute.
class FormalConcept[O: Object, A: Object]
# Concept attributes
var attributes = new HashSet[A]
# Concept objects
var objects = new HashSet[O]
# Is `self` a subconcept of `super_concept`?
#
# A concept C1 is a subconcept of C2 if C2 has all the objects of C1.
fun is_subconcept(super_concept: FormalConcept[O, A]): Bool do
if self == super_concept then return false
if objects.length > super_concept.objects.length then return false
return super_concept.objects.has_all(objects)
end
redef fun to_s do return "{attributes}\n{objects}"
end
lib/fca/fca.nit:182,1--216,3