NAME
Muldis::D::Ext::QBag - Muldis D extension for QBag specific operators
VERSION
This document is Muldis::D::Ext::QBag version 0.59.1.
PREFACE
This document is part of the Muldis D language specification, whose root document is Muldis::D; 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 QBag
document describes the system-defined Muldis D QBag Extension, which consists of generic operators that are specific to the QBag
parameterized q/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 Muldis::D::Core.
This documentation is pending.
SYSTEM-DEFINED QUASI-/BAG-CONCERNING FUNCTIONS
Each assuming
parameter is optional and defaults to the zero-attribute tuple if no explicit argument is given to it.
sys.std.QBag.cardinality
function sys.std.QBag.cardinality result NNInt params { topic(QBag) }
This function is like sys.std.Core.QRelation.cardinality
but that it accounts for the greater-than-one multiplicity of values in its argument; it results in the sum of the count
attribute of its argument.
sys.std.QBag.is_member
function sys.std.QBag.is_member result Bool params { bag(QBag), value(Universal) }
This function is the same as sys.std.QSet.is_member
, including that matching of value
is done against the value
attribute, except that it works with a QBag
rather than a QSet
.
sys.std.QBag.is_not_member
function sys.std.QBag.is_not_member result Bool params { bag(QBag), value(Universal) }
This function is exactly the same as sys.std.QBag.is_member
except that it results in the opposite boolean value when given the same arguments.
sys.std.QBag.count
function sys.std.QBag.count result NNInt params { bag(QBag), value(Universal) }
This function results in the multiplicity / count of occurrances of value
in bag
; if a q/tuple exists in bag
whose value
attribute is value
, then the result is its count
attribute; otherwise the result is zero.
sys.std.QBag.insertion
function sys.std.QBag.insertion result QBag params { bag(QBag), value(Universal) }
This function is the same as sys.std.QSet.insertion
as per is_member
but that its result differs depending on whether value
already exists in bag
; if it does, then no new q/tuple is added, but the count
attribute for the matching q/tuple is incremented by 1; if it does not, then a new q/tuple is added where its value
is value
and its count
is 1.
sys.std.QBag.deletion
function sys.std.QBag.deletion result QBag params { bag(QBag), value(Universal) }
This function is the same as sys.std.QSet.deletion
as per is_member
but that its result differs depending on what the count
for any q/tuple matching value
that already exists in bag
is; if the count
is greater than 1, then it is decremented by 1; if it is equal to 1, then the q/tuple whose value
is value
is deleted.
sys.std.QBag.reduction
function sys.std.QBag.reduction result Universal params { topic(QBag), func(FuncRef), assuming(QTuple)?, identity(Universal) }
This function is the same as sys.std.QSet.reduction
, including that input values for the reduction come from the value
attribute of topic
, except that it works with a QBag
rather than a QSet
; func
is invoked extra times, where both its v1
and v2
arguments might be different instances of the same value having >= 2 multiplicity.
sys.std.QBag.maybe_reduction
function sys.std.QBag.maybe_reduction result QMaybe params { topic(QBag), func(FuncRef), assuming(QTuple)? }
This function is to sys.std.QSet.maybe_reduction
as sys.std.QBag.reduction
is to sys.std.QSet.reduction
.
sys.std.QBag.QSet_from_QBag
function sys.std.QBag.QSet_from_QBag result QSet params { topic(QBag) }
This function results in the QSet
that is the projection of the value
attribute of its QBag
argument.
sys.std.QBag.QBag_from_QSet
function sys.std.QBag.QBag_from_QSet result QBag params { topic(QSet) }
This function results in the QBag
that is the extension of its QSet
argument with a new count
attribute whose value for every q/tuple is 1.
sys.std.QBag.QBag_from_wrap
function sys.std.QBag.QBag_from_wrap result quasi_bag_of.QTuple params { topic(QRelation) }
This function results in a QBag
whose value
attribute is q/tuple-typed and that attribute's values are all the q/tuples of topic
; is a short-hand for a relational wrap of all attributes of topic
such that the new q/tuple-valued attribute is named value
, and then that result is extended with a count
attribute whose value for every q/tuple is 1.
sys.std.QBag.QBag_from_attr
function sys.std.QBag.QBag_from_attr result QBag params { topic(QRelation), name(Name) }
This function results in a QBag
consisting of all the values of the attribute of topic
named by name
. It is a short-hand for first doing a relational group on all attributes of topic
besides name
to produce a new q/relation-typed attribute, and then extending the result of the group with a new positive integer attribute whose values are the cardinality of the q/relation-valued attribute's values, and then doing a binary projection of the named attribute and the new integer attribute plus their renaming to value
and count
respectively.
sys.std.QBag.is_subset
function sys.std.QBag.is_subset result Bool params { look_in(QBag), look_for(QBag) }
This function is like sys.std.Core.QRelation.is_subset
but that it accounts for the greater-than-one multiplicity of values in its arguments; this function returns Bool:true
iff the multiplicity of each look_for
value is less than or equal to the multiplicity of its counterpart look_in
value.
sys.std.QBag.is_not_subset
function sys.std.QBag.is_not_subset result Bool params { look_in(QBag), look_for(QBag) }
This function is like sys.std.Core.QRelation.is_not_subset
as per is_subset
.
sys.std.QBag.is_proper_subset
function sys.std.QBag.is_proper_subset result Bool params { look_in(QBag), look_for(QBag) }
This function is like sys.std.Core.QRelation.is_proper_subset
as per is_subset
. TODO: What is its definition?
sys.std.QBag.is_not_proper_subset
function sys.std.QBag.is_not_proper_subset result Bool params { look_in(QBag), look_for(QBag) }
This function is like sys.std.Core.QRelation.is_not_proper_subset
as per is_subset
. TODO: What is its definition?
sys.std.QBag.union
function sys.std.QBag.union result QBag params { topic(quasi_set_of.QBag) }
This function is like sys.std.Core.QRelation.union
but that it just looks at the value
attribute of its argument elements when determining what element q/tuples correspond; then for each q/tuple in the result, its count
attribute value is the maximum of the count
attribute values of its corresponding input element q/tuples.
sys.std.QBag.intersection
function sys.std.QBag.intersection result QBag params { topic(quasi_set_of.QBag) }
This function is like sys.std.Core.QRelation.intersection
as union
is like sys.std.Core.QRelation.union
; the minimum of count
attribute values is used rather than the maximum.
sys.std.QBag.difference
function sys.std.QBag.difference result QBag params { source(QBag), filter(QBag) }
This function is like sys.std.Core.QRelation.difference
as union
is like sys.std.Core.QRelation.union
; for corresponding input q/tuples, the result only has a q/tuple with the same value
if the count
of the source
q/tuple is greater than the count
of the filter
q/tuple, and the count
of the result q/tuple is the difference of those two.
SEE ALSO
Go to Muldis::D for the majority of distribution-internal references, and Muldis::D::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-2009, Muldis Data Systems, Inc.
See the LICENSE AND COPYRIGHT of Muldis::D for details.
TRADEMARK POLICY
The TRADEMARK POLICY in Muldis::D applies to this file too.
ACKNOWLEDGEMENTS
The ACKNOWLEDGEMENTS in Muldis::D apply to this file too.