-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmall.gdbot
56 lines (48 loc) · 2.89 KB
/
small.gdbot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# This line is a Comment
# Any blank lines are ignored
# Any line starting with % is an interpretation parameter for the whole .gdbot file
# Any line starting with : is a rule line
# Any other line is illegal
% file_title = "small gdbot sample file" # A reference name to put in the header of the log
% gdbot_syntax_version = 1.1 # In case the interpreter later needs to handle more flavours
% log_file = small.gdbotlog # filename, may include full or relative path.
% email_log = ([email protected], [email protected]) # if empty, don't send log file by email
# Next line shows a rule line structure
# : RuleID : RuleTitle : Mode : FC : FCsubtype : Condition : ActionType : Action : Comments
# Next lines are a sample rule line, with explanation
: 001 : Sample : SQL : DangersP,DangersA : 1 : SomeField NOT IN (1,2,3) AND SomeOtherField = 117 : FIX : SomeField = None, AnotherField = 5 : This is a sample line
# : 001 <- This is the rule number, it's integer.
# : Sample <- This is the rule name, it's string. Optional
# : SQL <- This is the rule interpretation mode. So far only SQL mode is available
# : DangersP <- The FC(s) affected by this rule. String, or comma-separated string, or * for all FCs
# : 1 <- The FCsubtype affected. * or comma-separated list of ints and s-57 codes
# ### s-57 codes are only accepted if exactly one FC is specified
# : SomeField NOT IN (1,2,3) AND SomeOtherField = 117 <- Condition describing an error state, in sql format ...
# : FIX <- What type of action to take. (FIX|LOG). i.e. Fix it or Log it.
# : SomeField = None, AnotherField = 5 <- How to repair. Must be "field name = value" format, possibly several comma-separated pairs.
# : This is a sample line <- The rest of the line you can write a message to yourself or others ...
# Some condition examples (SQL mode)
# is Null
# is not Null
# = 0
# <= 0
# != 0
# <> 0
# > 117
# not in (1,2,3)
# in (4,5,6)
# not in ('red','green',blue')
# not in ('red','green',blue'); case insensitive? <- not implemented yet
# Alternative - Should we maybe just allow SQL- and some REGEX-based syntax here ?
# The SqlRegex-syntax consists of the following base elements (,),AND,OR,NOT,SQL(),REGEX()
# (, ), AND, OR and NOT are traditional logical operators
# SQL() and REGEX() are interpreters of SQL and REGEX expressions respectively, they return TRUE, FALSE or ERROR
# The base elements can be combined, e.g. SQL(xxx) AND (REGEX(yyy) OR REGEX(zzz)) to be evaluated to an overall TRUE or FALSE
# In the SQL()string, the cell value is represented by %
# Example
# REGEX([0-9]) AND SQL(% BETWEEN 100 AND 500)
# Some examples of fix values:
# SomeField = NULL <- actual NULL/None
# SomeField = None <- actual NULL/None
# SomeField = [SomeOtherField] <- set the value to whatever is in the field SomeOtherField, NOT IMPLEMENTED YET
# SomeField = 5* [SomeOtherField] <- set the value to 5 times whatever is in the field SomeOtherField, rhs must be valid python code, NOT IMPLEMENTED YET