w3c / cogai

for work by the Cognitive AI community group
Other
53 stars 24 forks source link

Clarify that lists are ordered #36

Closed tidoust closed 3 years ago

tidoust commented 3 years ago

A value is either an atomic value or a list of atomic values. The spec should clarify that lists of atomic values are ordered.

rreck commented 3 years ago

Forgive me if this is already understood elsewhere, but is this to say there cannot be unordered values?

On Mon, 29 Mar 2021 05:31:47 -0700, François Daoust @.***> wrote:

A value is either an atomic value or a list of atomic values. The spec should clarify that lists of atomic values are ordered.

-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/cogai/issues/36

draggett commented 3 years ago

@rreck, you can represent unordered values as chunks, since chunks are not ordered. This issue is about how rule conditions are matched to the chunk in the module's buffer. A chunk property value is either a literal, a chunk ID, or a sequence thereof. Here we are talking about matching rule conditions, where the condition has a named property with a sequence of values. This sequence needs to be matched to the named property for the chunk in the module buffer. The matching algorithm expects the two sequences to have the same length and for each item in the sequence to also match.

More complex matching algorithms could be supported through actions that invoke a module's graph algorithms. The JavaScript chunks library allows the developer to declare new actions in addition to those that are built-in. The demos use this feature to allow rules to turn on lights, move robot arms, etc. In principle, graph algorithms can be implemented to support complex queries that are themselves expressed as chunk graphs, analogous to SPARQL and SHACL. I've done some work on that some years back ...

We can also contemplate extending the chunks rule language to directly support common matching algorithms, e.g. when you want to apply set operations to sequences. However, this increase in complexity of the rule engine needs to be justified with the benefits it would bring in practice. For now it seems wise to avoid prejudging matters, and to apply Occam's Razor and start simple, and to extend the rule language only when the need is clear.

tidoust commented 3 years ago

Spec was updated to say that list of atomic values are ordered and algorithms updated accordingly. Closing the issue accordingly.