Skip to content

Provisional: A framework for generalizing the SMSN 2.0's wiki markup data model.

Joshua Shinavier edited this page Mar 25, 2017 · 2 revisions

(This is largely a response to the page SmSn data model design. The RSLT is described here.)

Node types include text, (relationship) template, relationship, partial relationship = relationship test = (Relationship Node -> Bool), lens = (Node -> ?), and branchFold = (Show a => Node -> a). Relationship tests are implemented, as the RelSpec type. Lenses and branchFolds are not yet part of the RSLT spec.

Some pages are explicitly constructed|curated in the wiki markup format. Other pages, automatically constructed with no human curation, can look the same.

Explicitly wiki-formatted pages

Wiki headings are reusable partial relationships. For instance, suppose France is a page with a heading that displays as "Languages". That heading is represented as the partial relationship "languages $of _". It is partial in the sense that the first argument is supplied but not the second.

The contents of a heading (including the root) are "about" that root. For instance, for a page that displayed like this:

....France (heading)

........The French make great cheese!

........The French make lousy pineapple!

........Languages (heading)

............French (heading)

............Klingon (heading)

the sentence "The French make great cheese!" is about France. It could be represented as "France $view-under The French make great cheese!"

To save space, relationships can imply other relationships. For instance, above, if "Klingon $follows French $view-under France / Languages"(where the $ symbol binds after the /, which is like $ except it is always binary and transitive), we can infer that French and Klingon are both view-under France / Languages. (In that example, the / and the view-under relationship are the same relationship, but in general they could be separated.)

[I made some edits above and now the rest probably uses slightly worse terminology.] To reduce the number of edges in the graph, the "_ $about _" relationship can be inferred from a list. For instance, from "(The French make lousy pineapple!) $follows (The French make great cheese!) $(in the article about) France", one can infer that the pineapple statement is about France, without having to spend another edge on that relationship.

Thus the link from a heading to its first child is binary, while the link between successive children is ternary. The list of headings is handled similarly.

Lenses and constructed pages

The wiki view described above comes from a lens, the "explicit wiki markup" lens, which a new user does not need to know about initially. Other lenses can be instantiated, as nodes in the graph.

Given a node, a lens determines (1) which relationships involving the node to show, (2) the order to show them in, and (3) how to show each one.

Relationship tests are the way (1) is specified. Every partial relationship can be turned into a relationship test: for instance, the partial relationship "language $of _" matches "language $of France" but not "hobgoblin pizzerias $of France". Relationship tests are more general, though; for instance, "language|geograph $of _" could also be a relationship test, as could "any relationship involving y with arity greater than 2".

Order (2) can be specified simply by providing a list of templates (explicit orders) and "implicit orders". An example of an explicit order would be the relationship template "_ >(time) _" (which one might pronounce as "happened after"). An example of an implicit order would be "order by the sum of the dollar figures descended from the node".

Implicit orders require the representation of branchFolds. A branchFold is a function of type (Show a => Branch -> a); that is, from a Branch, it creates something showable. It might be a count of the number of children containing the word "turtle"; it might be simply the title of the node at the root of the branch; etc. (Maps from nodes to showable objects are a special case of branchFolds.)

The third component of a lens, how to show each node, is also defined in terms of branchFolds.