65 return std::set<std::string>{};
70 for (
const auto &v : vec) {
73 if(!result.has_value())
74 result = std::set<std::string>{};
75 result->insert(v->begin(), v->end());
85 for (
const auto &v : vec) {
88 result->insert(v->begin(), v->end());
98 if(std::includes(y->begin(), y->end(), x->begin(), x->end()))
100 std::set<std::string> diff;
102 x->begin(), x->end(),
103 y->begin(), y->end(),
104 std::inserter(diff, diff.end())
142 if(strcmp(v,
"⊥") == 0)
146 std::set<std::string> single;
147 single.insert(std::string(v));
151 const char *p = v + 1;
152 std::set<std::string> result;
161 const char *start = p;
162 while(*p && *p !=
',' && *p !=
'}' && *p !=
'{')
166 result.insert(std::string(start, p - start));
167 if(*p ==
',') { ++p;
continue; }
178 std::ostringstream oss;
179 if(!prov.has_value()) {
184 for (
const auto &label : *prov) {
185 if (!first) oss <<
",";
Abstract semiring interface for provenance evaluation.
Exception thrown when a semiring operation is not supported.
Abstract base class for (m-)semirings.
which_provenance_t value_type
Which-provenance (lineage) semiring.
value_type times(const std::vector< value_type > &vec) const override
Apply the multiplicative operation to a list of values.
value_type plus(const std::vector< value_type > &vec) const override
Apply the additive operation to a list of values.
value_type zero() const override
Return the additive identity .
std::string to_text(const value_type &prov) const
value_type monus(value_type x, value_type y) const override
Apply the monus (m-semiring difference) operation.
value_type parse_leaf(const char *v) const
Parse a leaf value into a which-provenance set.
value_type delta(value_type x) const override
Apply the operator.
value_type one() const override
Return the multiplicative identity .
virtual bool compatibleWithBooleanRewrite() const override
No semiring homomorphism BoolFunc(Y) →+* Which exists, so the safe-query Boolean rewrite is unsound u...
std::optional< std::set< std::string > > which_provenance_t
Which-provenance value: a set of labels, or (empty optional).