parse.
88 prm::o3prm::O3prmReader< GUM_SCALAR > reader;
96 std::string instanceName =
"";
103 +
"' found but class found. Generating unnamed instance.",
115 }
else if (prm->
classes().size() == 1) {
116 const std::string& entityName = (*prm->
classes().begin())->name();
117 ParseError warn(
false,
118 "Unique class '" + entityName
119 +
"' found. Generating unnamed instance.",
134 bn__->setProperty(
"name", entityName);
139 +
"' and more than one class.",
147 for (
auto node:
bn__->nodes()) {
149 const std::string& nn =
bn__->variable(node).name();
150 bn__->variable(node).setDescription(nn);
153 auto start = nn.find_first_of(
'(');
154 auto end = nn.find_first_of(
')');
155 if (0 < start && start < end && end < nn.size()) {
156 auto path = nn.substr(0, start);
157 auto type = nn.substr(start + 1, end - start - 1);
158 auto name = nn.substr(end + 1, std::string::npos);
160 std::string newNameRadical
163 std::string newName = newNameRadical;
171 bn__->changeVariableName(node, newName);
173 ParseError warn(
false,
174 "Name " + nn +
" cannot be simplified.",
bool contains(const Key &k) const
Indicates whether a given elements belong to the set.
bool isClass(const std::string &name) const
void add(NodeId id, PRMInstance< GUM_SCALAR > &instance)
Add an PRMInstance<GUM_SCALAR> to a given PRMReferenceSlot, PRMSlotChain<GUM_SCALAR> or output node...
An PRMInstance is a Bayesian network fragment defined by a Class and used in a PRMSystem.
const Set< PRMClass< GUM_SCALAR > *> & classes() const
Returns the Set of all Class<GUM_SCALAR> in this PRM.
static std::string getInstanceName__(const std::string &classname)
void add(ParseError error)
Add an error object to the container.
static std::string getVariableName__(const std::string &path, const std::string &type, const std::string &name, const std::string &toRemove="")
std::string to_string(const Formula &f)
void generateBN__(prm::PRMSystem< GUM_SCALAR > &system)
bool isSystem(const std::string &name) const
PRMSystem< GUM_SCALAR > & getSystem(const std::string &name)
Returns a constant reference on a PRMSystem<GUM_SCALAR> given it's name.
A PRMSystem is a container of PRMInstance and describe a relational skeleton.
BayesNet< GUM_SCALAR > * bn__
This class represents a Probabilistic Relational PRMSystem<GUM_SCALAR>.
PRMClass< GUM_SCALAR > & getClass(const std::string &name)
Returns a constant reference on a Class<GUM_SCALAR> given it's name.
Size errors()
publishing Errors API
void insert(const Key &k)
Inserts a new element into the set.