Question

I'm working on some code that assesses data in a database to see if instances in a stream of incoming events comply with a set of protocols. The idea is to use pyDatalog to do this. Ideally, we would like to be able to assess the data against several independent rule sets, which define separate protocols the events should comply with.

In other words, is it possible to create several logically independent pyDatalog sessions which each have their own sets of rules, but take data from the same underlying database?

Was it helpful?

Solution

Support for multiple rule set is planned for release 0.14, together with thread safety.

With the current and previous releases, you can store the different rule sets in the same pyDatalog session, provided that there is no predicate name conflicts. For example, you could prefix each predicate by an identifier of the rule set it belongs too. Then, by calling the appropriate predicate, you'll activate the relevant rule set, without visible performance loss.

For prefixed predicates (referring to a python class, e.g. Employee.id[X]==Y), you would need to create python subclasses with the appropriate prefix. You could see some performance drop, but that should be small.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top