Jump to content

Wikifunctions:Type proposals/Semantic unit/Douglas Adams

This page gives an example of how to build abstract content using semantic units.

Note that most examples (except the first) do not directly use those units, with the expectation that contributors will instead express them using the syntax described under 'Read function' in the type proposal.

Preliminaries

Statements under consideration

The sentences listed in Wikifunctions:Type proposals/Abstract sentence/Douglas Adams are reproduced here:

  • "Douglas Adams was a British writer."
  • "He is famous for The Hitchhiker's Guide to the Galaxy series."
  • "Adams was born in Cambridge the 11 March 1952."

General principles: worldbuilding

Since the three statements above consider real, specific entities with individual Wikidata items (Q42 (Q42), The Hitchhiker's Guide to the Galaxy (Q25169), Cambridge (Q350), even March 11, 1952 (Q69280357)), there isn't much to do in the bulleted respects below, but the following will nevertheless be important for more complex situations.

As a general rule, the statements we want to render typically do not exist in a vacuum; there is some suite of circumstances (a context (Q196626), if you will) that needs to be constructed for those statements to make sense. Perhaps a term that could be used for this construction process is worldbuilding (Q1822655).

Instantiating a context (Q196626) is as simple as

 ["Q196626", ...]

where what follows are any number of abstract content pieces and any number of directives doing things to the context.

Here are some of the things that become possible to do:

  • If you need to refer to 'this chair', 'a shirt', or any object that does not have a Wikidata item of its own, you can define an entity (declaration (Q1183659)) and assign to it an identifier--perhaps a Wikidata item ID that was never used by Wikidata, like "Q3149"?--and then refer to that entity consistently within abstract content. In Ninai these entities are generally Wikidata item objects (Wikibase item (Q29934200)), similar to how Chair of Reniseneb (Q55606908) and "58% Don't Want Pershing" t-shirt (Q137802536) describe individual chairs and shirts:
    ["Q1183659", "Q3149", "Q29934200"]
    • Adding (currently using name binding (Q16928028) in Ninai, though a better item choice is welcome!) instance of (P31) computer desk (Q363931) to a newly defined entity will allow it to be referred to, at minimum, as "a computer desk":
      ["Q16928028", "Q3149", "P31", "Q363931"]
    • Adding labels in different languages, or statements like official name (P1448) or name (P2561), allow it to be referred to using those names as well:
      ["Q16928028", "Q3149", "Len", "Lucas"], ["Q16928028", "Q3149", "P735", "Q12325000"]
    • Adding statements like has characteristic (P1552) allow those characteristics to be used in references to those entities:
      ["Q16928028", "Q3149", "P1552", "Q107998880"]
    • The 'speaker (Q2324479)/writer' of the abstract content, as well as the 'listener (Q108606601)/reader' of it, are also modeled as item objects, if you wanted to modify any information about those as well:
      ["Q16928028", "Q2324479", "P106", "Q2883465"], ["Q16928028", "Q108606601", "P3716", "Q3443060"]
      • (Consider languages in which the second-person pronoun is not used in many situations, requiring some alternate way of addressing the 'listener/reader'.)
  • If you want to specify that the abstract content should prefer terms with language style (P6191) slang (Q8102) if they exist, then you can set (currently using system configuration (Q7663702) in Ninai, though a better item choice is welcome!) the style (Q2313235) of the context and then all abstract content appearing after that setting will be rendered with that preference in mind:
    ["Q7663702", ":root", "Q2313235", "Q8102"]
  • If you want to specify that the temporal point of reference was, for instance, 200 years ago, you can set the Q2875947 (Q2875947) of the context, and then all abstract content appearing after that setting will be rendered relative to that reference point:
    ["Q7663702", ":root", "Q2875947", "1826-04-19T00:00:00+00:00"]
    • This can transform, for example, statements typically realized using verbs "built" and "will build" to statements typically realized using e.g. "had built" and "will have built".
    • Likewise, to treat the time of 'speaking/writing' as a specific date/time instead of the value of {{CURRENTTIMESTAMP}}, you can set the value of now (Q18488805) of the context appropriately:
      ["Q7663702", ":root", "Q18488805", "2026-04-18T00:00:00+00:00"]

Worldbuilding time

Statement decomposition

Before trying to go ahead and compose abstract content, it is important to develop the ability to decompose a sentence, however simple or complex it may seem, into the underlying assertions that are being made in it.

For instance, "Douglas Adams was a British writer." makes two simpler assertions:

1. Douglas Adams was British.
2. Douglas Adams was a writer.

You could easily combine the two assertions above to yield the same information with different emphasis on either one:

  • Douglas Adams, who was British, was a writer.
  • Douglas Adams, who was a writer, was British.

Likewise we can see in the second sentence two more simple assertions, which are connected in a effect-precedes-cause relation (Q139481811):

3. Douglas Adams is famous.
4. Douglas Adams wrote the Hitchhiker's Guide to the Galaxy.

Note a few things about the formulations above:

  • The pronoun "he" is not used at all. A text in which all pronouns referring to entities are resolved to those entities should still be a valid text; as such the abstract content should not consider their presence, and any details for making them present in a given language should be cleanly separable from the abstract content itself. (Note that this excludes e.g. the 'it' in 'it is raining' since 'it' here does not refer to an entity.)
  • The connection to the book series is made explicit. There will likely be languages where abbreviating away the 'writing' part is not realistically possible or pragmatically warranted.

The last sentence is actually a single assertion with two circumstantial details (the date and the place of birth), so no decomposition is needed here:

5. Douglas Adams was born in Cambridge the 11 March 1952.

Content assembly

Below are the five individual assertions above, turned into abstract content:

Abstract contentExpandedPossible output
["Q124316841",
  ["Q151885", "Q42"],
  ["Q151885", "Q36180"],
  ["Q7806609", "Q7805404", ["Q116880167", "Q69303834"]]]
(classificational construction (Q124316841),

 (concept (Q151885), Q42 (Q42)),
 (concept (Q151885), writer (Q36180)),
 (timestamping (Q7806609), time of occurrence (Q7805404), (DateTime (Q116880167), May 10, 2001 (Q69303834))))

Douglas Adams was a writer. (en)
["Q124317331",
  ["Q151885", "Q42"],
  ["Q217438", "Q145"],
  ["Q7806609", "Q7805404", ["Q116880167", "Q69303834"]]]
(attributional construction (Q124317331),

 (concept (Q151885), Q42 (Q42)),
 (demonym (Q217438), United Kingdom (Q145)),
 (timestamping (Q7806609), time of occurrence (Q7805404), (DateTime (Q116880167), May 10, 2001 (Q69303834))))

Douglas Adams was British. (en)
["Q124317331",
  ["Q151885", "Q42"],
  ["Q151885", "Q12942806"]]
(attributional construction (Q124317331),
 (concept (Q151885), Q42 (Q42)),
 (demonym (Q217438), famous (Q12942806)))
Douglas Adams is famous. (en)
["Q179080", "Q86647781",
  ["Q613930", "Q36180", ["Q151885", "Q42"]],
  ["Q613930", "Q47461344", ["Q151885", "Q25169"]],
  ["Q7806609", "Q7805404", ["Q116880167", "Q69293450"]]]
(predicate (Q179080), writing (Q86647781),

 (thematic relation (Q613930), writer (Q36180), (concept (Q151885), Q42 (Q42))),
 (thematic relation (Q613930), written work (Q47461344), (concept (Q151885), The Hitchhiker's Guide to the Galaxy (Q25169))),
 (timestamping (Q7806609), time of occurrence (Q7805404), (DateTime (Q116880167), March 8, 1978 (Q69293450))))

Douglas Adams wrote The Hitchhiker's Guide to the Galaxy.
["Q179080", "Q111811625",
  ["Q613930", "Q170212", ["Q151885", "Q42"]],
  ["Q109377685", ["Q151885", "Q350"]],
  ["Q12322185"],
  ["Q7806609", "Q7805404", ["Q116880167", "Q69280357"]]]
(predicate (Q179080), born (Q111811625),

 (thematic relation (Q613930), patient (Q170212), (concept (Q151885), Q42 (Q42))),
 (location role (Q109377685), (concept (Q151885), Cambridge (Q350))),
 (time (Q12322185)),
 (timestamping (Q7806609), time of occurrence (Q7805404), (DateTime (Q116880167), March 11, 1952 (Q69280357))))

Douglas Adams was born in Cambridge the 11 March 1952. (en)

Semantic unit breakdown

To better elaborate on the structure of the semantic units when the syntax above is parsed, here's the breakdown of the semantic units from the first assertion:

Assertion combination/modification

Below are combinations and modifications of some of those assertions:

Abstract contentExpandedPossible output
["Q124316841",
  ["Q151885", "Q42"],
  ["Q151885", "Q36180"],
  ["Q7806609", "Q7805404", ["Q116880167", "Q69303834"]],
  ["Q124317331",
    ["Q151885", "Q42"],
    ["Q217438", "Q145"],
    ["Q7806609", "Q7805404", ["Q116880167", "Q69303834"]]]]
(classificational construction (Q124316841),

 (concept (Q151885), Q42 (Q42)),
 (concept (Q151885), writer (Q36180)),
 (timestamping (Q7806609), time of occurrence (Q7805404), (DateTime (Q116880167), May 10, 2001 (Q69303834))),
 (attributional construction (Q124317331),
  (concept (Q151885), Q42 (Q42)),
  (demonym (Q217438), United Kingdom (Q145)),
  (timestamping (Q7806609), time of occurrence (Q7805404), (DateTime (Q116880167), May 10, 2001 (Q69303834)))))

Douglas Adams was a British writer. (en)
["Q124317331",
  ["Q151885", "Q42"],
  ["Q151885", "Q12942806"],
  ["Q139481811",
    ["Q179080", "Q86647781",
      ["Q613930", "Q36180", ["Q151885", "Q42"]],
      ["Q613930", "Q47461344", ["Q151885", "Q25169"]],
      ["Q7806609", "Q7805404", ["Q116880167", "Q69293450"]]]]]
(attributional construction (Q124317331),

 (concept (Q151885), Q42 (Q42)),
 (concept (Q151885), famous (Q12942806)),
 (effect-precedes-cause relation (Q139481811),
  (predicate (Q179080), writing (Q86647781),
   (thematic relation (Q613930), writer (Q36180), (concept (Q151885), Q42 (Q42))),
   (thematic relation (Q613930), written work (Q47461344), (concept (Q151885), The Hitchhiker's Guide to the Galaxy (Q25169))),
   (timestamping (Q7806609), time of occurrence (Q7805404), (DateTime (Q116880167), March 8, 1978 (Q69293450))))))

Douglas Adams is famous because Douglas Adams wrote The Hitchhiker's Guide to the Galaxy. (en)

The final combined abstract content, on wrapping in the appropriate context, would thus look like this:

["Q196626",
  ["Q124316841",
    ["Q151885", "Q42"],
    ["Q151885", "Q36180"],
    ["Q7806609", "Q7805404", ["Q116880167", "Q69303834"]],
    ["Q124317331",
      ["Q151885", "Q42"],
      ["Q217438", "Q145"],
      ["Q7806609", "Q7805404", ["Q116880167", "Q69303834"]]]],
  ["Q124317331",
    ["Q151885", "Q42"],
    ["Q151885", "Q12942806"],
    ["Q139481811",
      ["Q179080", "Q86647781",
        ["Q613930", "Q36180", ["Q151885", "Q42"]],
        ["Q613930", "Q47461344", ["Q151885", "Q25169"]],
        ["Q7806609", "Q7805404", ["Q116880167", "Q69293450"]]]]],
  ["Q179080", "Q111811625",
    ["Q613930", "Q170212", ["Q151885", "Q42"]],
    ["Q109377685", ["Q151885", "Q350"]],
    ["Q12322185"],
    ["Q7806609", "Q7805404", ["Q116880167", "Q69280357"]]]]

(This three-sentence example is 785 bytes indented and spaced, 614 bytes when whitespace is omitted, and anywhere from 174 to 301 bytes when that whitespace-free version is compressed according to https://iamroot.tech/compression/. For comparison's sake, this two-sentence page is 2521 bytes indented and spaced, 695 bytes when whitespace is omitted, and anywhere from 186 to 324 bytes when that whitespace-free version is compressed.)

Notes about the above

  • timestamping (Q7806609) sets the value of a configuration option, whose name is provided as a first argument, to the value provided in the second argument.
    • DateTime (Q116880167) is used to assemble a timestamp string (currently ISO 8601 in Ninai, as used by Python's datetime library; maybe EDTF could be used in the future?).
      • Keep in mind that the syntax used here is composed of list of lists of strings; as such, individual Wikifunctions types are not assumed to be definable here unless there are semantic unit types, similar to DateTime (Q116880167), that when rendered yield objects of those types.
    • The configuration options currently control how tense/aspect are realized in Ninai's current language renderers.
    • time (Q12322185) is assumed above, when no arguments are provided to it, to assemble some temporal expression based on configuration information.
  • Typographic and styling issues (e.g. boldface or wikilinks) are not dealt with in the content above; these, like the choice to realize certain noun references as pronouns, are best left as editorial decisions.