RelationalMap

RelationalMap

new RelationalMap()

Description:
  • Implements a macroscopic ersatz of a VSA relational map.

    • An relational map is created adding new symbols triples.
    • It is implemented via Bundling and double Binding, without using a C++ map.

Methods

add(subject, beliefopt, predicate, object) → {RelationalMap}

Description:
  • Adds a new symbolic triple to the container.

    • For convinience the symbol can be given by its name, considering that tau = 1, sigma = 0.
Parameters:
Name Type Attributes Description
subject Symbol | String

The triple subject to add.

belief Belief | double <optional>

An optional belief, or tau value, applied on the predicate.

predicate Symbol | String

The triple predicate to add.

object Symbol | String

The triple object to add.

Returns:

A reference to this relational map, allowing to chain add methods.

Type
RelationalMap

add(map) → {RelationalMap}

Description:
  • Adds all triple of a relation map in this one.

Parameters:
Name Type Description
map RelationMap

The triples to append to this relation map

Returns:

A reference to this relational map, allowing to chain add methods.

Type
RelationalMap

add(filename) → {RelationalMap}

Description:
  • Adds all triple read from a text file with N-Triples syntax.

Parameters:
Name Type Description
filename String

The filename N-Triples syntax, with the triples to append to this relation map

Returns:

A reference to this relational map, allowing to chain add methods.

Type
RelationalMap

get(name) → {Symbol}

Description:
  • Returns an approximate value of the relational map by unbinding.

Parameters:
Name Type Description
name Symbol

The symbol name.

Returns:

value A pointer to the stored value, to be deleted after use.

Type
Symbol

get()

Description:
  • Defines an iterator over the relational map symbols, used in a construct of the form:

     for(auto it = relationalMap.Bundling::get().cbegin(); it != relationalMap.Bundling::get().cend(); it++) {
       const Binding& binding_spo = dynamic_cast <const Binding&> (it->second);
       const Binding& binding_po = dynamic_cast <const Binding&> (binding_spo.x());
       const Symbol& subject = binding_spo.y(), predicate = binding_po.y(), object = binding_po.x();
       ../..
     }
    
Returns:

A const std::map <unsigned int, Symbol& >& reference for relational map iteration.

asString() → {String}

Description:
  • Returns the value as a string.

Returns:

A string of the form {\n\t(subject_i predicate_i object_i)_<belief> ...\n}_<belief>, omitting belief if tau=1, sigma=0.

Type
String

(static) asString(subject, beliefopt, predicate, object) → {String}

Description:
  • Returns the value of a triple as a string.

    • For convinience the symbol can be given by its name, considering that tau = 1, sigma = 0.
Parameters:
Name Type Attributes Description
subject Symbol | String

The triple subject to add.

belief Belief <optional>

An optional belief apply on the predicate.

predicate Symbol | String

The triple predicate to add.

object Symbol | String

The triple object to add.

Returns:

A string of the form (subject_i predicate_i object_i)_<belief>, omitting belief if tau=1, sigma=0.

Type
String

save(filename)

Description:
  • Saves the triples of this relation map text file in partial [Turtle](https://en.wikipedia.org/wiki/Turtle_(syntax) syntax.

Parameters:
Name Type Description
filename String

The output file name.