— Naming facts

What’s in a name? That which we call a rose
By any other name would smell as sweet;

Romeo and Juliet, Act II, Scene II

The concept of naming in Defernia facts is simple: every fact doesn’t have its name but references do. Assume that there are two character facts A and B and a relationship that B is a mather of A and A call his mather “Su Gorgias”. Thus “Su Gorgias” is a name of B.

In this concept, every fact’s names can be multiple. Assume that there are three character facts A, B and C; B is a mother of A and A call his mother “Su Gorgias”; C is a father of A; B and C are married and C call his wife “郭譽”. Thus B has her two names: “Su Gorgias” and “郭譽”.

As a result, names can be weighted by the number of references. The weightiest names become the canonical names automatically.


The mapping table that contains existing names of the fact. Each value has a list of back references and each key has their common name. It implements collections.Mapping interface.

For example, assume that there are several relationships between some facts:

  • B calls A, his daughter, 郭譽.
  • C calls A, his mother, 憲宗.
  • D calls A, his mother, 憲宗.
  • E calls A, his wife, Su Gorgias.

And assume also there is a fact object a that represents the below A, and then its NameMap will work like: (non-ASCII characters are unescaped for readability)

>>> names = NameMap(a)  
>>> list(names)  
[u'憲宗', u'Su Gorgias', u'郭譽']
>>> [(name, len(refs)) for name, refs in names.items()] 
[(u'憲宗', 2), (u'Su Gorgias', 1), (u'郭譽', 1)]

As you can guess from the below example, it works like a sorted map: these are sorted by their number of references. Moreover there is the property that contains the canonical name: canon.

Parameters:fact (Fact) – the fact what the names are of
fact = None

(Fact) The fact what the names are of.


(basestring) The canonical name of the fact. It can be None when there are no names for the fact.

Project Versions

Previous topic — Object system for conworld ontologies

Next topic — Transcendental fact types

This Page