clorm icon indicating copy to clipboard operation
clorm copied to clipboard

Better handling of nullary predicates

Open daveraja opened this issue 3 years ago • 0 comments

Nullary (0-arity) predicates don't really fit the ORM model. Currently, it is possible to declare nullary predicates in clorm by simply not specifying a parameter to the predicate class definition.

  class P(Predicate): pass

But this creates a predicate sub-class only to match a single proposition "p" and every python instance of P will match the same predicate. If you have a lot of nullary predicates in your ASP program then you have to create a class for every one of them. This is very heavy handed and doesn't make it very useful to integrate into clorm queries.

So we need a better way to deal with nullary predicates. Currently, I don't have a clear idea. Maybe create a special case NullaryPredicate class to store arbitrary nullary predicates (eg., "p","q","r","s", ...). But integrating it into the factbase query language might still be very hacky.

daveraja avatar Sep 25 '21 03:09 daveraja