I have开发者_如何学Python written/am writing a large number of predicates for testing the state of a single complex entity. These predicates are partially LINQ queries (that I assume are turned into SQL) and partially C# lambda/methods used to verify the state of the entity.
This all seems to remind me of digital design and K-maps. But maybe that is a wrong turn
I doubt I am the first person to have this problem. Can anyone tell me what design patterns or best practices are available in this area?
The main question is "how are you going to use these predicates?" These predicates should be organized for fast retrieval of relevant predicates for the tasks in your particular domain. Since domains differ, the appropriate indexing strategy may differ as well.
For example, if groups of predicates are related to concepts and need to be retrieved by concept, you could use a conceptual graph and spreading activation strategy to retrieve relevant predicates.
Or simple hash tables and trees might be all that you need, indexing by predicates (aka relations) within the query and the attributes within the predicate (relation).
精彩评论