Current and Correct Documentation of Syntax for Things and Items Needed

Happy to help. This stuff is complicated and it takes a bit to get the concepts straight.

Access to static methods and members uses “::” (e.g. Math::max(myNumber)). Why is it different? Who knows. You don’t have to import Math or anything else from java.lang.

I don’t understand.

I recommend looking at the Design Pattern postings. Coding in the Rules DSL is particularly challenging for programmers. The Rules DSL has a lot of features built into it that can make for some very terse and simple logic. However, if you try to code it as if it were an OO or procedural language it will fight you every step of the way and you will hate life.

As an example, see this example written by a C++ coder and my response with a much simpler approach:

Alternatively, if you don’t mind waiting (how long I don’t know) for the JSR233 binding to be upgraded to work with OH 2 you can code your rules in Jython, JavaScript, or Groovy if that is more your speed (I happen to appreciate the Rules DSL despite its many flaws).

But some rules of thumb for success with the Rules DSL:

  • avoid trying to create data structures, use Items and Group membership instead
  • avoid using named lambdas, combine Rules and use Separation of Behaviors and Group processing instead
  • take advantage of the resources OH provides (e.g. use Persistence rather than keeping timestamps, use Groups and Associated Items instead of Maps

Obviously these are all rules of thumb, not strict dictates. But I do treat the creation of data structures (which is awkward in the Rules DSL to put it nicely) and excessive use of named lambdas as code smells. There needs to be a good justification for using them.

It may not be that obvious. My understanding is that the actual base is Xtext (or maybe Xbase) with a custom grammar. There may not be actual code that you will find, at least not code that you will find useful. You may only find the grammars that these third party libraries use to define the langauge. Look for .xtext or .xbase files.