Modifying Knot Pages

From Knot Atlas
Jump to navigationJump to search

Knot pages on The Knot Atlas can be modified in three ways:

  • Beginner. Only the knot page being viewed is modified, and only in certain specific places.
  • Intermediate. These are modifications that effect the way all knot pages (or sometimes just all knot pages of a given class) are displayed, but no new "per knot" data is introduced.
  • Expert. Introduces new invariants, pictures or data on all knot pages.

Beginner Mode Editing: Using Existing Hooks

On every knot page there are a number of "named editing hooks"; links bearing names such as Edit 5_1 Further Notes and Views, which contain the explicit name of the knot being studied. Clicking on a named editing hook allows you to edit (wiki-style) the section that follows it on the knot page. Just for fun, put your name in the obvious place (down at the bottom) using Edit 5_1 Further Notes and Views and see how it affects the knot page 5_1.

Intermediate Mode Editing: Modifying Templates

In MediaWiki talk, each knot page contains just one element: a template call with many parameters (the values of the various "invariants" of that knot, including names of image files, etc.). That templates renders a knot page with the given values for its invariants. So the appearance of knot pages, including the addition/modification/removal of the named editing hooks of the beginners section, can be controlled by modifying this "master" template. At the moment there are four knot tables on the Knot Atlas, and hence four master templates. These are: Template:Rolfsen Knot Page (used, for example, in 5_1), Template:Hoste-Thistlethwaite Knot Page (used in K11n13), Template:Link Page (used in L10a9) and Template:Torus Knot Page (used in T(7,6)). Each such master template contains a link to itself somewhere near its bottom, and the result is that every knot page contains somewhere near its bottom a link to the template that renders it. Find it on 5_1!

Each master template in itself calls a number of "slave" templates which render smaller parts of knot pages. Some of these slave templates, and some subsections of the master templates, can be reached directly from the knot pages with certain "unnamed editing hooks". (Find them on 5_1). Many (hopefully all!) of the slave templates used are in the Category:Invariant Template, and often their 'discussion' page describes the parameters they use.

Warning: Some slave templates are shared between several masters. So editing Template:Khovanov Homology, for example, will change the way Khovanov Homology is displayed on several types of knot pages.

Expert Mode Editing: Data Uploading and Splicing

At the moment there are two Knot Atlas experts and they do "bulk editing" (adding invariants or pictures to all knots at the same time) in two different ways (though the first of those is now preferred).

Scott's way: Data Uploading

Much of the data in the Knot Atlas is stored in separate pages, and included (technically, transcluded) as needed. Here's how it works.

The page Data:7_5/Jones_Polynomial (go have a look!) contains the wiki text

<math> q^{-2} - q^{-3} +3 q^{-4} -3 q^{-5} +3 q^{-6} -3 q^{-7} +2 q^{-8} - q^{-9} </math>

Any other page can include this text, so that it appears inline. Thus if a page contains the text

The Jones polynomial of the knot [[7_5]] is {{Data:7_5/Jones_Polynomial}}.

it will render as

The Jones polynomial of the knot 7_5 is .

All of this included data lives in the 'Data' namespace (that is, the page names start with Data:), and there's quite a lot of it!

One advantage of having all this data inside the wiki is that we can construct the individual knot pages without having to splice the data into each page. Instead, on each and every knot page we can put text like:

 The Jones polynomial of {{PAGENAME}} is {{Data:{{PAGENAME}}/Jones_Polynomial}}.

When this text appears on the page 7_5, it displays as

The Jones polynomial of 7_5 is .

but when is appears on the page 7_6 it displays as

The Jones polynomial of 7_6 is .

In fact, we do something even more complicated. The pages 7_5 and 7_6 don't actually contain any real text or formatting commands, they simply call other templates that produce each section. These templates can still take advantadge of the {{PAGENAME}} trick to include the appropriate data. You can find more information about modifying these templates in the sections above.

If you want to add more data to the Knot Atlas, you're welcome to go ahead and create more pages in the Data namespace, and then modify the knot page templates to transclude your new data. There are several ways in which you might want to do this.

Uploading data with WikiLink

If you're already using Mathematica, you might find that the package WikiLink gives you all you need to upload your data to the wiki. The function WikiSetPageText is essentially all you'll need. If you use the package KnotTheory as well, you'll find functions like ToString[#, WikiForm], which outputs Mathematica expressions as wiki text, as well as NameString, which converts a knot (as an expression like Knot[3,1] or Link[11, NonAlternating, 5]) into the name of its Knot Atlas page.


Uploading data using KnotTheory`

In your KnotTheory` distribution, look in the directory KnotTheory/KnotAtlas for the file ManagingKnotData-demo.nb. This is a Mathematica notebook demonstrating the use of the data management features of KnotTheory`, which provides high level functions for moving data to and from the Knot Atlas. It's pretty cool, and extensible. The invariants it knows about are specified at Invariant Definition Table, which is directly editable through the wiki.

Uploading data from KnotTheory` to the Knot Atlas can be as simple as this:

In[1]:= InvariantNames[Invariants["KnotTheory` Knot Invariants"]]
Out[1]= {"Next Knot", "Previous Knot", "Dowker-Thistlethwaite Code", "Jones Polynomial", etc...}
In[2]:= data = RetrieveInvariants[Invariants["KnotTheory` Knot Invariants"], AllKnots[{0, 5}], "KnotTheory"];
In[3]:= StoreInvariants[data1,"KnotAtlas"]
Out[3]= {}
Uploading data using some other langauge

If your data is not in Mathematica, or you're not familiar with it, you may decide to try uploading data directly. If you're uploading more data of a type already in the wiki, make sure you use the same naming scheme. (Either look in the knot page templates to see how they are transcluded, have a look at [1], or look in the column 'WikiPage' in the Invariant Definition Table.) There are the java classes underlying the WikiLink package, the Python Mediawiki Robot Framework, something similar in Perl, called Anura and some others.

Dror's way: Splicing (deprecated)

Each knot page calls a master template, assigning value to lots of parameters, and these values are the values of the various "invariants" of that knot, including honest knot-theoretic invariants, names of image files and even a long text field that renders a simulated Mathematica session. That knot page in itself is generated using Mathematica from a (wiki-editable!) "splice base", a certain text file that contains wiki commands as well as well-marked Mathematica commands. Mathematica goes over the splice base and finds the marked commands; it executes those and replaces them with the output that they produce. This action is called "splicing" and it is very similar to the action of the Mathematica Splice command.

For example, the splice base may contain a part like

 {{Rolfsen Knot Page|
   braid_index     = <*BraidIndex[K]*>

The delimeters for marked text are <* and *>, and hence the Mathematica-marked text here is BraidIndex[K]. When splicing into the page for 5_1 Mathematica sets the value of K to be Knot[5, 1], and the package KnotTheory` knows that the braid index of 5_1 is 2, and so it replaces the string <*BraidIndex[K]*> appearing in the base with the string 2. Thus the knot page for 5_1 contains a part that looks like

 {{Rolfsen Knot Page|
   braid_index     = 2

When handled by MediaWiki this becomes a call to the master template "Rolfsen Knot Page" with value 2 for the parameter braid_index. "Rolfsen Knot Page" then puts the value 2 in the appropriate place on the page 5_1.

The Mathematica program that performs all this sorcery is a Mathematica notebook, KnotPageSpliceRobot.nb (File:KnotPageSpliceRobot.nb). If you've gone this far, you are an expert and you'll have no difficulty figuring out how it works by downloading it and reading the instructions within the notebook and by looking at the current splice bases Rolfsen Splice Base, Hoste-Thistlethwaite Splice Base, Link Splice Base and Torus Knot Splice Base (at the bottom of every knot page you'll find a link to its parent splice base).

When running KnotPageSpliceRobot.nb you'll need the following:

  1. Mathematica.
  2. The Mathematica Package KnotTheory`
  3. The "extra definitions" file KnotTheoryExtra.m (File:KnotTheoryExtra.m) (this will eventually be incorporated into KnotTheory`).
  4. Java (usually included with Mathematica).
  5. WikiLink.
  6. And KnotPageSpliceRobot.nb, of course.