Skip to main content
  • Home
  • Development
  • Documentation
  • Donate
  • Operational login
  • Browse the archive

swh logo
SoftwareHeritage
Software
Heritage
Archive
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

https://gitlab.inria.fr/line/aide-group/macrovsa
04 May 2026, 13:41:51 UTC
  • Code
  • Branches (1)
  • Releases (0)
  • Visits
    • Branches
    • Releases
    • HEAD
    • refs/heads/master
    No releases to show
  • d85ce8c
  • /
  • src
  • /
  • RelationalMap.hpp
Raw File Download Save again
Take a new snapshot of a software origin

If the archived software origin currently browsed is not synchronized with its upstream version (for instance when new commits have been issued), you can explicitly request Software Heritage to take a new snapshot of it.

Use the form below to proceed. Once a request has been submitted and accepted, it will be processed as soon as possible. You can then check its processing state by visiting this dedicated page.
swh spinner

Processing "take a new snapshot" request ...

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
  • revision
  • snapshot
origin badgecontent badge
swh:1:cnt:04209d9b205e5c708f3e69982f4367146c9f2a1f
origin badgedirectory badge
swh:1:dir:b8157120e03f8858febdc76e496e300e843c5750
origin badgerevision badge
swh:1:rev:31a87d848f8ab28a06ccf77d0b359fc966974138
origin badgesnapshot badge
swh:1:snp:ffb1e6ef77e78b82672462770a7171c80c299b3b

This interface enables to generate software citations, provided that the root directory of browsed objects contains a citation.cff or codemeta.json file.
Select below a type of object currently browsed in order to generate citations for them.

  • content
  • directory
  • revision
  • snapshot
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
(requires biblatex-software package)
Generating citation ...
Tip revision: 31a87d848f8ab28a06ccf77d0b359fc966974138 authored by vthierry on 15 December 2025, 21:31:50 UTC
sync from makefile
Tip revision: 31a87d8
RelationalMap.hpp
#ifndef __macrovsa_RelationalMap__
#define __macrovsa_RelationalMap__

#include "Symbol.hpp"
#include "Bundling.hpp"

namespace macrovsa {
  /**
   * @class 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](./Bundling.html) and double [Binding](./Binding.html), without using a C++ map.
   * @extends Bundling
   */
  class RelationalMap: public Bundling {
public:
    RelationalMap() {}
    RelationalMap(String name) : Bundling(name) {}

    /**
     * @function add
     * @memberof RelationalMap
     * @instance
     * @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`.
     * @param {Symbol|String} subject The triple subject to add.
     * @param {Belief|double} [belief] An optional belief, or `tau` value, applied on the predicate.
     * @param {Symbol|String} predicate The triple predicate to add.
     * @param {Symbol|String} object The triple object to add.
     */
    void add(const Symbol& subject, const Symbol& predicate, const Symbol& object);
    void add(String subject, const Symbol& predicate, const Symbol& object)
    {
      const Symbol s(subject);
      add(s, predicate, object);
    }
    void add(const Symbol& subject, String predicate, const Symbol& object)
    {
      const Symbol p(predicate);
      add(subject, p, object);
    }
    void add(const Symbol& subject, const Symbol& predicate, String object)
    {
      const Symbol o(object);
      add(subject, predicate, o);
    }
    void add(String subject, String predicate, const Symbol& object)
    {
      const Symbol s(subject), p(predicate);
      add(s, p, object);
    }
    void add(String subject, const Symbol& predicate, String object)
    {
      Symbol s(subject), o(object);
      add(s, predicate, o);
    }
    void add(const Symbol& subject, String predicate, String object)
    {
      const Symbol p(predicate), o(object);
      add(subject, p, o);
    }
    void add(String subject, String predicate, String object)
    {
      const Symbol s(subject), p(predicate), o(object);
      add(s, p, o);
    }
    void add(const Symbol& subject, const Belief& belief, const Symbol& predicate, const Symbol& object)
    {
      add(subject, *clone(predicate, belief, symbols), object);
    }
    void add(String subject, const Belief& belief, const Symbol& predicate, const Symbol& object)
    {
      const Symbol s(subject);
      add(s, *clone(predicate, belief, symbols), object);
    }
    void add(const Symbol& subject, const Belief& belief, String predicate, const Symbol& object)
    {
      const Symbol p(predicate);
      add(subject, *clone(p, belief, symbols), object);
    }
    void add(const Symbol& subject, const Belief& belief, const Symbol& predicate, String object)
    {
      const Symbol o(object);
      add(subject, *clone(predicate, belief, symbols), o);
    }
    void add(String subject, const Belief& belief, String predicate, const Symbol& object)
    {
      Symbol s(subject), p(predicate);
      add(s, *clone(p, belief, symbols), object);
    }
    void add(String subject, const Belief& belief, const Symbol& predicate, String object)
    {
      Symbol s(subject), o(object);
      add(s, *clone(predicate, belief, symbols), o);
    }
    void add(const Symbol& subject, const Belief& belief, String predicate, String object)
    {
      Symbol p(predicate), o(object);
      add(subject, *clone(p, belief, symbols), o);
    }
    void add(String subject, const Belief& belief, String predicate, String object)
    {
      Symbol s(subject), p(predicate), o(object);
      add(s, *clone(p, belief, symbols), o);
    }
    /**
     * @function add
     * @memberof RelationalMap
     * @instance
     * @description Adds all triple of a relation map in this one.
     * @param {RelationMap} map The triples to append to this relation map
     */
    void add(const RelationalMap& map);

    /**
     * @function add
     * @memberof RelationalMap
     * @instance
     * @description Adds all triple read from a text file with N-Triples syntax.
     * @param {String} filename The filename [N-Triples](https://en.wikipedia.org/wiki/N-Triples) syntax, with the triples to append to this relation map
     */
    void add(String filename);

    /**
     * @function get
     * @memberof RelationalMap
     * @instance
     * @description Returns an approximate value of the relational map by unbinding.
     * @param {Symbol} name The symbol name.
     * @return {Symbol} value A pointer to the stored value, to be deleted after use.
     */
    Symbol *get(const Symbol& name) const;

    /**
     * @function get
     * @memberof RelationalMap
     * @instance
     * @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();
     *    ../..
     *  }
     * ```
     * @return A `const std::map <unsigned int, Symbol& >&` reference for relational map iteration.
     */

    /**
     * @function asString
     * @memberof RelationalMap
     * @instance
     * @description Returns the value as a string.
     * @return {String} A string of the form `{\n\t(subject_i predicate_i object_i)_<belief> ...\n}_<belief>`, omitting belief if `tau=1, sigma=0`.
     */
    virtual std::string asString() const;

    /**
     * @function asString
     * @memberof RelationalMap
     * @static
     * @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`.
     * @param {Symbol|String} subject The triple subject to add.
     * @param {Belief} [belief] An optional belief apply on the predicate.
     * @param {Symbol|String} predicate The triple predicate to add.
     * @param {Symbol|String} object The triple object to add.
     * @return {String} A string of the form `(subject_i predicate_i object_i)_<belief>`, omitting belief if `tau=1, sigma=0`.
     */
    static std::string asString(const Symbol& subject, const Symbol& predicate, const Symbol& object);
    static std::string asString(String subject, const Symbol& predicate, const Symbol& object)
    {
      Symbol s(subject);
      return asString(s, predicate, object);
    }
    static std::string asString(const Symbol& subject, String predicate, const Symbol& object)
    {
      Symbol p(predicate);
      return asString(subject, p, object);
    }
    static std::string asString(const Symbol& subject, const Symbol& predicate, String object)
    {
      Symbol o(object);
      return asString(subject, predicate, o);
    }
    static std::string asString(String subject, String predicate, const Symbol& object)
    {
      Symbol s(subject), p(predicate);
      return asString(s, p, object);
    }
    static std::string asString(String subject, const Symbol& predicate, String object)
    {
      Symbol s(subject), o(object);
      return asString(s, predicate, o);
    }
    static std::string asString(const Symbol& subject, String predicate, String object)
    {
      Symbol p(predicate), o(object);
      return asString(subject, p, o);
    }
    static std::string asString(String subject, String predicate, String object)
    {
      Symbol s(subject), p(predicate), o(object);
      return asString(s, p, o);
    }
    static std::string asString(const Symbol& subject, const Belief& belief, const Symbol& predicate, const Symbol& object)
    {
      Symbol p(predicate, belief);
      return asString(subject, p, object);
    }
    static std::string asString(String subject, const Belief& belief, const Symbol& predicate, const Symbol& object)
    {
      Symbol s(subject), p(predicate, belief);
      return asString(s, p, object);
    }
    static std::string asString(const Symbol& subject, const Belief& belief, String predicate, const Symbol& object)
    {
      Symbol p(predicate, belief);
      return asString(subject, p, object);
    }
    static std::string asString(const Symbol& subject, const Belief& belief, const Symbol& predicate, String object)
    {
      Symbol p(predicate, belief), o(object);
      return asString(subject, p, o);
    }
    static std::string asString(String subject, const Belief& belief, String predicate, const Symbol& object)
    {
      Symbol s(subject), p(predicate, belief);
      return asString(s, p, object);
    }
    static std::string asString(String subject, const Belief& belief, const Symbol& predicate, String object)
    {
      Symbol s(subject), p(predicate, belief), o(object);
      return asString(s, p, o);
    }
    static std::string asString(const Symbol& subject, const Belief& belief, String predicate, String object)
    {
      Symbol p(predicate, belief), o(object);
      return asString(subject, p, o);
    }
    static std::string asString(String subject, const Belief& belief, String predicate, String object)
    {
      Symbol s(subject), p(predicate, belief), o(object);
      return asString(s, p, o);
    }
    /**
     * @function save
     * @memberof RelationalMap
     * @instance
     * @description Saves the triples of this relation map text file in partial [Turtle](https://en.wikipedia.org/wiki/Turtle_(syntax) syntax.
     * @param {String} filename The output file name.
     */
    void save(String filename) const;
  };
}

#endif

back to top

Software Heritage — Copyright (C) 2015–2026, The Software Heritage developers. License: GNU AGPLv3+.
The source code of Software Heritage itself is available on our development forge.
The source code files archived by Software Heritage are available under their own copyright and licenses.
Terms of use: Archive access, API— Content policy— Contact— JavaScript license information— Web API