rule_generator
generate_multiple_rule_asp_definition(rule_inputs, with_comments=False, custom_nodes=None)
Given multiple rule inputs, generate the corresponding ASP definition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rule_inputs |
List[RuleInput]
|
list of rule input objects to translate |
required |
with_comments |
bool
|
whether to include ASP comments |
False
|
custom_nodes |
Optional[Dict[str, Type]]
|
dictionary of node_key and corresponding class generating the node |
None
|
Returns:
| Type | Description |
|---|---|
Tuple[str, Dict[str, str]]
|
tuple of ASP definition and mapping dictionary (ASP rule to original rule id) |
Source code in json_logic_asp/translator/rule_generator.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
generate_single_rule_asp_definition(rule_input, with_comments=False, custom_nodes=None)
Given a single rule input, generate the corresponding ASP definition.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rule_input |
RuleInput
|
rule input object to translate |
required |
with_comments |
bool
|
whether to include ASP comments |
False
|
custom_nodes |
Optional[Dict[str, Type]]
|
dictionary of node_key and corresponding class generating the node |
None
|
Returns:
| Type | Description |
|---|---|
str
|
ASP definition |
Source code in json_logic_asp/translator/rule_generator.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | |