Cardinality restriction on combination of multiple classes

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Cardinality restriction on combination of multiple classes

jritch33
Hello!

I've made considerable progress since my last question thanks to your help!

My next question: Consider the equivalency declarations below. I want to classify a pizza as a SupremePizzaOne if it has >= 4 meat or fruit toppings. It could be 3 meat and 2 fruit or 10 meat and 6 fruit (that's one supreme pizza), just so long as it is greater than 4 total toppings of meat or fruit toppings.

class SupremePizzaOne(onto.Pizza):
... equivalent_to = [
... onto.Pizza
... & ( onto.has_topping.min(4, onto.MeatTopping, onto.FruitTopping)
... ) ]

class SupremePizzaTwo(onto.Pizza):
... equivalent_to = [
... onto.Pizza
... & ( onto.has_topping.min(5, onto.MeatTopping, onto.NutTopping, onto.FruitTopping)
... ) ]

In bold is the effect I am trying to accomplish although this is syntactically incorrect. Is there a correct way to accomplish this?

Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Cardinality restriction on combination of multiple classes

Jiba
Administrator
Hello,

I think you should combine your class with an OR (or union) operator, for exemple :

class SupremePizzaOne(onto.Pizza):
... equivalent_to = [
... onto.Pizza
... & ( onto.has_topping.min(4, onto.MeatTopping | onto.FruitTopping)
... ) ]

Best regards,
Jiba
Reply | Threaded
Open this post in threaded view
|

Re: Cardinality restriction on combination of multiple classes

jritch33
Perfect, thanks!