NAME
Language::MuldisD::Ext::Bag - Muldis D extension for Bag specific operators
VERSION
This document is Language::MuldisD::Ext::Bag version 0.20.0.
PREFACE
This document is part of the Muldis D language specification, whose root document is Language::MuldisD; you should read that root document before you read this one, which provides subservient details.
DESCRIPTION
Muldis D has a mandatory core set of system-defined (eternally available) entities, which is referred to as the Muldis D core or the core; they are the minimal entities that all Muldis D implementations need to provide; they are mutually self-describing and are used to bootstrap the language; any entities outside the core, called Muldis D extensions, are non-mandatory and are defined in terms of the core or each other, but the reverse isn't true.
This current Bag
document describes the system-defined Muldis D Bag Extension, which consists of generic operators that are specific to the Bag
parameterized relation type, and said operators are short-hands for generic relational operators in the language core.
This current document does not describe the polymorphic operators that all types, or some types including core types, have defined over them; said operators are defined once for all types in Language::MuldisD::Core.
This documentation is pending.
SYSTEM-DEFINED BAG-CONCERNING FUNCTIONS
function sys.Bag.Bag.cardinality result UInt params { topic(Bag) }
-
This function is like
sys.Core.Relation.cardinality
but that it accounts for the greater-than-one multiplicity of values in its argument; it results in the sum of thecount
attribute of its argument. function sys.Bag.Bag.is_member result Bool params { bag(Bag), value(ScaTupRel) }
-
This function is the same as
sys.Set.Set.is_member
, including that matching ofvalue
is done against thevalue
attribute, except that it works with aBag
rather than aSet
. function sys.Bag.Bag.is_not_member result Bool params { bag(Bag), value(ScaTupRel) }
-
This function is exactly the same as
sys.Bag.Bag.is_member
except that it results in the opposite boolean value when given the same arguments. function sys.Bag.Bag.count result UInt params { bag(Bag), value(ScaTupRel) }
-
This function results in the multiplicity / count of occurrances of
value
inbag
; if a tuple exists inbag
whosevalue
attribute isvalue
, then the result is itscount
attribute; otherwise the result is zero. function sys.Bag.Bag.insertion result Bag params { bag(Bag), value(ScaTupRel) }
-
This function is the same as
sys.Set.Set.insertion
as peris_member
but that its result differs depending on whethervalue
already exists inbag
; if it does, then no new tuple is added, but thecount
attribute for the matching tuple is incremented by 1; if it does not, then a new tuple is added where itsvalue
isvalue
and itscount
is 1. function sys.Bag.Bag.deletion result Bag params { bag(Bag), value(ScaTupRel) }
-
This function is the same as
sys.Set.Set.deletion
as peris_member
but that its result differs depending on what thecount
for any tuple matchingvalue
that already exists inbag
is; if thecount
is greater than 1, then it is decremented by 1; if it is equal to 1, then the tuple whosevalue
isvalue
is deleted. function sys.Bag.Bag.reduction result ScaTupRel params { topic(Bag), func(Cat.NameChain), assuming(Tuple), identity(ScaTupRel) }
-
This function is the same as
sys.Set.Set.reduction
, including that input values for the reduction come from thevalue
attribute oftopic
, except that it works with aBag
rather than aSet
;func
is invoked extra times, where both itsv1
andv2
arguments might be different instances of the same value having >= 2 multiplicity. function sys.Bag.Bag.maybe_reduction result Maybe params { topic(Bag), func(Cat.NameChain), assuming(Tuple) }
-
This function is to
sys.Set.Set.maybe_reduction
assys.Bag.Bag.reduction
is tosys.Set.Set.reduction
. function sys.Bag.Bag.Set_from_Bag result Set params { topic(Bag) }
-
This function results in the
Set
that is the projection of thevalue
attribute of itsBag
argument. function sys.Bag.Bag.Bag_from_Set result Bag params { topic(Set) }
-
This function results in the
Bag
that is the extension of itsSet
argument with a newcount
attribute whose value for every tuple is 1. function sys.Bag.Bag.Bag_from_wrap result BagOfTuple params { topic(Relation) }
-
This function results in a
Bag
whosevalue
attribute is tuple-typed and that attribute's values are all the tuples oftopic
; is a short-hand for a relational wrap of all attributes oftopic
such that the new tuple-valued attribute is namedvalue
, and then that result is extended with acount
attribute whose value for every tuple is 1. function sys.Bag.Bag.Bag_from_attr result Bag params { topic(Relation), name(Cat.Name) }
-
This function results in a
Bag
consisting of all the values of the attribute oftopic
named byname
. It is a short-hand for first doing a relational group on all attributes oftopic
besidesname
to produce a new relation-typed attribute, and then extending the result of the group with a new positive integer attribute whose values are the cardinality of the relation-valued attribute's values, and then doing a binary projection of the named attribute and the new integer attribute plus their renaming tovalue
andcount
respectively. function sys.Bag.Bag.is_subset result Bool params { look_in(Bag), look_for(Bag) }
-
This function is like
sys.Core.Relation.is_subset
but that it accounts for the greater-than-one multiplicity of values in its arguments; this function returnsBool:true
iff the multiplicity of eachlook_for
value is less than or equal to the multiplicity of its counterpartlook_in
value. function sys.Bag.Bag.is_not_subset result Bool params { look_in(Bag), look_for(Bag) }
-
This function is like
sys.Core.Relation.is_not_subset
as peris_subset
. function sys.Bag.Bag.is_proper_subset result Bool params { look_in(Bag), look_for(Bag) }
-
This function is like
sys.Core.Relation.is_proper_subset
as peris_subset
. TODO: What is its definition? function sys.Bag.Bag.is_not_proper_subset result Bool params { look_in(Bag), look_for(Bag) }
-
This function is like
sys.Core.Relation.is_not_proper_subset
as peris_subset
. TODO: What is its definition? function sys.Bag.Bag.union result Bag params { topic(SetOfBag) }
-
This function is like
sys.Core.Relation.union
but that it just looks at thevalue
attribute of its argument elements when determining what element tuples correspond; then for each tuple in the result, itscount
attribute value is the maximum of thecount
attribute values of its corresponding input element tuples. function sys.Bag.Bag.intersection result Bag params { topic(SetOfBag) }
-
This function is like
sys.Core.Relation.intersection
asunion
is likesys.Core.Relation.union
; the minimum ofcount
attribute values is used rather than the maximum. function sys.Bag.Bag.difference result Bag params { source(Bag), filter(Bag) }
-
This function is like
sys.Core.Relation.difference
asunion
is likesys.Core.Relation.union
; for corresponding input tuples, the result only has a tuple with the samevalue
if thecount
of thesource
tuple is greater than thecount
of thefilter
tuple, and thecount
of the result tuple is the difference of those two.
SEE ALSO
Go to Language::MuldisD for the majority of distribution-internal references, and Language::MuldisD::SeeAlso for the majority of distribution-external references.
AUTHOR
Darren Duncan (perl@DarrenDuncan.net
)
LICENSE AND COPYRIGHT
This file is part of the formal specification of the Muldis D language.
Muldis D is Copyright © 2002-2008, Darren Duncan.
See the LICENSE AND COPYRIGHT of Language::MuldisD for details.
ACKNOWLEDGEMENTS
The ACKNOWLEDGEMENTS in Language::MuldisD apply to this file too.