The table API reference

Copyright 2020 Simon Vandevelde, Bram Aerts, Joost Vennekens This code is licensed under GNU GPLv3 license (see LICENSE) for more information. This file is part of the cDMN solver.

class table.Table(array: numpy.array, parser: cdmn.idply.Parser)[source]

The table object represents decision and constraint tables.

Attr name:

str

Attr hit_policy:

str

Attr inputs:

List[np.array]

Attr outputs:

List[np.array]

Attr rules:

List[np.array]

export()[source]

Export tries to find the hit policy for a table, and then returns the method needed to transfer the table to idp form. These hit policies are currently:

  • A, U, F -> translate to definitions;

  • E* -> translate to implications;

  • C+, C<, C>, C# -> translate to aggregates;

  • FO -> translate directly to FO.

Every hit policy has its own method.

Returns method:

the output of export method for the table.

find_auxiliary() List[str][source]

Every output in a C# table needs to use an auxiliary variable to work correctly. This method makes a list of those output variables, so that the auxiliary versions can be created.

Returns List[str]:

property fstring: str

Method to decide the string format for a certain hit policy.

Returns str:

the format string.

variables_iq_oq(repres=None)[source]

Method to generate the needed variables and quantifiers :returns variables, iquantors, oquantors: TODO

table.is_singular_value(string: str) bool[source]

Check whether a cell contains a singular value, such as “foo”. Specifically look for signs that there might be multiple values, such as “-”, “,”, …

Parameters:

string – the content of a cell in string form

Returns bool:

table.is_variable_introducing(string: str, variables: OrderedDict) bool[source]

Checks whether a column name is variable introducing. There’s two types of variable introducing columns:

  1. Using “Type called T” syntax

  2. Just using “Type”

Parameters:

string – the headerstring of a column.

Returns bool:

table.typeiname(string: str) str[source]

Function to return the type of a header in the form of “Type called var”

Parameters:

string – the headerstring of which the variable name needs to be found.

Returns str:

the variable name.

table.variname(string: str) str[source]

Function to return the variable of a header in the form of “Type called var”

Parameters:

string – the headerstring of which the variable name needs to be found.

Returns str:

the variable name.