neuralogic.db

class PostgresConverter(model, table_mappings: List[TableMapping], settings: Settings)[source]

Bases: Converter

static get_function(name: str, params: List[str], return_type: List[str], body: str, language: str = 'SQL', volatility: str = 'STABLE') str[source]
static get_empty_function(name: str, params: List[str], return_type: List[str], language: str = 'SQL', volatility: str = 'STABLE') str[source]
get_helpers(functions: Set[str]) str[source]
get_fact_sql_function(relation: BaseRelation, index: int, weight_indices: List[int], weights) str[source]

Generate a SQL function for a ground fact

get_relation_interface_sql_function(relation: str, arity: int) Tuple[str, str][source]

Return the SQL function that should by used by the end users

get_rule_aggregation_function(name: str, arity: int, number_of_rules: int, activation: str, aggregation: str, is_fact: bool = False) str[source]

Generete SQL function which aggregates rule functions (something like the aggregation neuron)

get_rule_sql_function(rule: Rule, index: int, activation: str, aggregation: str, weight_indices: List[int], weights) str[source]

Return the SQL function of one rule

class TableMapping(relation_name: str, table_name: str, term_columns: List[str], value_column: str | None = None)[source]

Bases: object

relation_name: str
table_name: str
term_columns: List[str]
value_column: str | None = None
class Converter(model, table_mappings: List[TableMapping], settings: Settings)[source]

Bases: object

get_relation_interface_sql_function(relation: str, arity: int) Tuple[str, str][source]
get_rule_sql_function(rule: Rule, index: int, activation: str, aggregation: str, weight_indices: List[int], weights) str[source]
get_fact_sql_function(relation: BaseRelation, index: int, weight_indices: List[int], weights) str[source]
get_rule_aggregation_function(name: str, arity: int, number_of_rules: int, activation: str, aggregation: str, is_fact: bool = False) str[source]
get_helpers(functions: Set[str]) str[source]
get_std_functions() str[source]
to_sql() str[source]