Skip to content

Latest commit

 

History

History
139 lines (102 loc) · 4.95 KB

101.md

File metadata and controls

139 lines (102 loc) · 4.95 KB

DIP-101

word types

General principle

Words (defined in DIP-100) will be organized into categories called word types. Most words will belong to multiple word types.

Discussion

Word types play a special role in concepts.

Wheareas json schemas are the start of a class thread, and a class instance is the end of a class thread, the word type is the focal point; the center of gravity, the anchor. We might speak of "the set of all widgets" (here "widgets" refers to widgets, the superset), but we speak of "the abstract notion of a widget", "the concept of a widget", or "the concept for widget" (here "widget" refers to widget, the word type).

Top level property

Conventions:

  • Given a word with wordType: foo, there must be a top-level property fooData
  • Word types will be indicated in the array wordData.wordTypes as in the example below. (word may be omitted from the wordData.wordTypes array, since it is assumed.)

These are top level properties for each of the structural word types of the concept for foo:

word type top level property
foo fooData
word wordData
wordType wordTypeData
list listData
animal animalData
rating ratingData
ratingTemplate ratingTemplateData

Alternate convention for top-level property

The standard convention is for the top-level property for a word of wordType = foo to be fooData. According to this convention, foo is a slug: it is a human-readable identifier, typically camelCase, which is unique within the context of its local environment (within its concept graph).

An alternative convention may be used in which a universally unique cryptographic identifier may be used in place of the locally unique identifier slug. So for example: in place of fooData, the top level domain could be abcde12345, where abcde12345 is the nostr id, the ipfs hash, or the ipns name of the word which serves as the declaration of the wordType: foo. This may be of use if the local environment is unknown or not established.

Declaration

See here.

Examples

Example of a word of wordType: widget. Note the existence of widget as an element of wordData.wordTypes and widgetData as a top level property.

{
  "wordData": {
    "slug": "myWidget_e12345",
    "wordTypes": ["word", "widget"],
  },
  "widgetData": {
    "slug": "myWidget",
    "name": "my widget",
    "title": "My Widget",
    "description": "lorem ipsum",
  }
}

Example of a word with multiple wordTypes:

{
  "wordData": {
    "slug": "Fido_e12345",
    "wordTypes": ["word", "animal", "dog"],
  },
  "animalData": {
    "animalType": "dog",
  },
  "dogData": {
    "name": "Fido",
  }
}

By convention, wordData is always the first property in the word. In this particular example, it is true that dogs is a subset of animals which is a subset of words. When present, subset relationships such as these are, by convention, used to determine the order: word, then animal, then dog, not only in wordData.wordTypes, but also in the ordering of the top-level properties (wordData, animalData, dogData).

Replacements of locally unique identifiers with globally unique identifiers inside wordTypes

In the array wordData.wordTypes, the slug may be replaced by a unique cryptographic identifier. For example, the above example could be modified like this:

  "wordData": {
    "slug": "Fido_e12345",
    "wordTypes": ["word", "abcde12345", "dog"],
  },
  ...

where abcde12345 is the nostr event id (or ipfs hash or ipns name or some other unique identifier) used to identify the word that provides the declaration (see below) of the wordType: animal.

Likewise, animalData could be replaced with abcde12345Data.

One of the rules of a concept graph (see later DIP) is the rule that each and every word in the concept graph has a locally unique (local to the concept graph) human readable identifier. Typically, the locally unique human readable identifier will be a slug. Therefore, normally animal and animalData will suffice, so that abcde12345 and abcde12345Data are not necessary.

Creation / declaration of a new wordType

Implicit declaration:

  • the creation of a word with top-level property fooData implies the word type foo.
  • the declaration of a list (see upcoming DIP)
  • the declaration of a concept (see upcoing DIP)

Explicit declaration: One of the most important word types is, if you can believe it: wordType. It can be used to declare other word types, as in the example below:

Declaration of the word type: animal:

{
  "wordData": {
    "wordTypes": ["word", "wordType"],
  },
  "wordTypeData": {
    "slug": "animal",
  }
}

Declaration of the word type: wordType:

{
  "wordData": {
    "wordTypes": ["word", "wordType"],
  },
  "wordTypeData": {
    "slug": "wordType",
  }
}

For more examples, see declarations.