Scott's Data Management Robot

This notebook contains, "Scott's Robot", described in http://katlas.math.toronto.edu/wiki/Modifying_Knot_Pages...

After downloading it, KnotTheory` and WikiLink.m, it takes five steps to run Scott's Robot:
1. Set the KnotTheory` directory and load KnotTheory`.
2. Set the WikiLink directory and load WikiLink.m.
3. Create the WikiLink connection to the Knot Atlas wiki server.
4. Load ManagingKnotData.m and retrieve the "Invariant Definition Table"
5. Upload some data!

1. Set the KnotTheory` directory and load KnotTheory`.

Change "KnotAtlasPath" as appropriate for your system (e.g., it should be the directory above "KnotTheory/") and execute the following cell:

Dror's version

KnotAtlasPath  =  "C:/drorbn/KAtlas/";
AppendTo[$Path,  KnotAtlasPath];
<<  KnotTheory`

Scott's version

\(\(KnotTheoryPath\  = \ "c:\scott\projects\svn-checkouts\KnotTheory\trunk\";\)\)
AppendTo[$Path,  KnotTheoryPath];
<<  KnotTheory`

2. Create the WikiLink connection to the Knot Atlas wiki server.

Execute the cell below. You will be prompted for your username and password on the Knot Atlas wiki.

\( (*CreateWikiConnection[
"http://katlas.math.toronto.edu/w/index.php", 
InputString["Enter Your Username:"], 
InputString["Enter Your Password"]
]*) \)

\(CreateWikiConnection[
"http://katlas.math.toronto.edu/w/index.php", 
"ScottDataRobot", 
InputString["Enter Your Password"]
]\)

WikiUserName[]

3. Upload some data!

This asks the KnotTheory` package for some data.

data1 = 
      RetrieveInvariants[Invariants["KnotTheory` Knot Invariants"], 
        AllKnots[{0, 5}], "KnotTheory"]

This writes it into the Knot Atlas! StoreInvariants returns a list of failures, so if this returns an empty list, all is going well!

StoreInvariants[data1, "KnotAtlas"]

RetrieveInvariants[{"Next Knot"}, 
      AllKnots[6], "KnotAtlas"]

FindDataDiscrepancies[Invariants["KnotTheory` Knot Invariants"], 
      AllKnots[3], "KnotTheory", "KnotAtlas"]

We can also retrieve data from Charles Livingston's KnotInfo server, automatically.

RetrieveInvariants[{"Khovanov s-Invariant"}, 
      AllKnots[{3, 6}], "KnotInfo"]

StoreInvariants[
      RetrieveInvariants[{"Khovanov s-Invariant"}, 
        AllKnots[11], "KnotInfo"], "KnotAtlas"]

And, of course, then write this into the KnotAtlas.

StoreInvariants[
        RetrieveInvariants[{"Conway Notation"}, 
          AllKnots[4], "KnotInfo"], "KnotAtlas"] // 
      AbsoluteTiming

RetrieveInvariants[{"Concordance Order"}, 
      AllKnots[6], "KnotInfo"]

RetrieveInvariants[{"Ozsvath-Szabo Tau Invariant"}, 
      AllKnots[{3, 6}], "KnotAtlas"]

StoreInvariants[
      RetrieveInvariants[{"Conway Notation"}, 
        AllKnots[{3, 6}], "KnotInfo"], "KnotAtlas"]

RetrieveInvariants[{"Conway Notation"}, 
      AllKnots[{3, 6}], "KnotAtlas"]

StoreInvariants[
        RetrieveInvariants[{"Conway Notation"}, 
          AllKnots[7], "KnotInfo"], "KnotAtlas"] // 
      AbsoluteTiming

StoreInvariants[
        RetrieveInvariants[{"Conway Notation", "Ozsvath-Szabo Tau \
Invariant"}, AllKnots[{3, 7}], "KnotInfo"], "KnotAtlas"] // 
      AbsoluteTiming

StoreInvariants[
        RetrieveInvariants[{"Thurston-Bennequin Number"}, 
          AllKnots[9], "KnotInfo"], "KnotAtlas"] // 
      AbsoluteTiming

StoreInvariants[
        RetrieveInvariants[{"Thurston-Bennequin Number"}, 
          AllKnots[10], "KnotInfo"], "KnotAtlas"] // 
      AbsoluteTiming

StoreInvariants[
        RetrieveInvariants[{"Thurston-Bennequin Number"}, 
          AllKnots[{3, 6}], "KnotInfo"], "KnotAtlas"] // 
      AbsoluteTiming

StoreInvariants[
        RetrieveInvariants[{"Conway Notation", "Ozsvath-Szabo Tau \
Invariant"}, AllKnots[8], "KnotInfo"], "KnotAtlas"] // 
      AbsoluteTiming

StoreInvariants[
        RetrieveInvariants[{"Conway Notation", "Ozsvath-Szabo Tau \
Invariant"}, AllKnots[9], "KnotInfo"], "KnotAtlas"] // 
      AbsoluteTiming

StoreInvariants[
        RetrieveInvariants[{"Conway Notation", "Ozsvath-Szabo Tau \
Invariant"}, AllKnots[10], "KnotInfo"], "KnotAtlas"] // 
      AbsoluteTiming

StoreInvariants[
        RetrieveInvariants[{"Conway Notation", "Ozsvath-Szabo Tau \
Invariant"}, AllKnots[11, Alternating], "KnotInfo"], "KnotAtlas"] // 
      AbsoluteTiming

StoreInvariants[
        RetrieveInvariants[{"Conway Notation"}, 
          AllKnots[11], "KnotInfo"], "KnotAtlas"] // 
      AbsoluteTiming

StoreInvariants[
        RetrieveInvariants[{"Hyperbolic Volume"}, 
          AllKnots[8], "KnotInfo"], "KnotAtlas"] // 
      AbsoluteTiming

StoreInvariants[
        RetrieveInvariants[{"Hyperbolic Volume"}, 
          AllKnots[9], "KnotInfo"], "KnotAtlas"] // 
      AbsoluteTiming

StoreInvariants[
        RetrieveInvariants[{"Hyperbolic Volume"}, 
          AllKnots[10], "KnotInfo"], "KnotAtlas"] // 
      AbsoluteTiming

StoreInvariants[
        RetrieveInvariants[{"Hyperbolic Volume"}, 
          AllKnots[11, Alternating], "KnotInfo"], "KnotAtlas"] // 
      AbsoluteTiming

StoreInvariants[
        RetrieveInvariants[{"Hyperbolic Volume"}, 
          AllKnots[11, NonAlternating], "KnotInfo"], "KnotAtlas"] // 
      AbsoluteTiming

WikiGetPageText["Data:5_1/HyperbolicVolume"]

StoreInvariants[
        RetrieveInvariants[Invariants["KnotTheory` Knot Invariants"], 
          AllKnots[{0, 6}], "KnotTheory"], "KnotAtlas"] // 
      AbsoluteTiming

StoreInvariants[
        RetrieveInvariants[Invariants["KnotTheory` Knot Invariants"], 
          AllKnots[7], "KnotTheory"], "KnotAtlas"] // 
      AbsoluteTiming

StoreInvariants[
        RetrieveInvariants[Invariants["KnotTheory` Knot Invariants"], 
          AllKnots[8], "KnotTheory"], "KnotAtlas"] // 
      AbsoluteTiming

StoreInvariants[
        RetrieveInvariants[Invariants["KnotTheory` Knot Invariants"], 
          AllKnots[9], "KnotTheory"], "KnotAtlas"] // 
      AbsoluteTiming

StoreInvariants[
        RetrieveInvariants[Invariants["KnotTheory` Knot Invariants"], 
          AllKnots[10], "KnotTheory"], "KnotAtlas"] // 
      AbsoluteTiming

StoreInvariants[
        RetrieveInvariants[Invariants["KnotTheory` Knot Invariants"], 
          AllKnots[11], "KnotTheory"], "KnotAtlas"] // 
      AbsoluteTiming

StoreInvariants[
        RetrieveInvariants[Invariants["KnotTheory` Link Invariants"], 
          AllLinks[{1, 5}], "KnotTheory"], "KnotAtlas"] // 
      AbsoluteTiming

StoreInvariants[
        RetrieveInvariants[Invariants["KnotTheory` Link Invariants"], 
          AllLinks[], "KnotTheory"], "KnotAtlas"] // 
      AbsoluteTiming

Further examples

RetrieveInvariant["Next Knot", 
      Knot[10, 20], "KnotTheory"]

RetrieveInvariants[{"Next Knot", "Previous Knot"}, {Knot[10, 
          20], Knot[10, 21]}, "KnotTheory"]

RetrieveInvariant["Next Knot", 
      Knot[10, 20], "KnotAtlas"]

RetrieveInvariant["Next Knott", 
      Knot[10, 20], "KnotAtlas"]

RetrieveInvariants[{"Next Knot", "Previous Knot"}, {Knot[10, 
          20], Knot[10, 21]}, "KnotAtlas"]

data = 
      RetrieveInvariants[Invariants["Navigation"], 
        AllKnots[{0, 4}], "KnotTheory"]

StoreInvariants[data, "KnotAtlas", Write -> False]

StoreInvariants[data, "KnotAtlas"]

Now we'll simulate a vandal, and use FindDataDiscrepancies to reveal the problem.

realData = 
      RetrieveInvariants[{"Next Knot"}, {Knot[10, 
            20]}, "KnotTheory"]

Make some fake data instead

fakeData = {{"Next Knot", Knot[10, 20], 
            Knot[10, 22]}};

StoreInvariants[fakeData, "KnotAtlas"]

RetrieveInvariants[{"Next Knot"}, {Knot[10, 
          20]}, "KnotAtlas"]

Mwhahaha! Our virtual vandal has succeeded to putting erroneous data in the Knot Atlas. However, now it's easy to catch!

FindDataDiscrepancies[{"Next Knot"}, {Knot[10, 
          20]}, "KnotTheory", "KnotAtlas"]

Now clean up our mess!

StoreInvariants[realData, "KnotAtlas"]

Reformatting the Invariant Definition Table on the wiki.

LoadInvariantRules["Invariant_Definition_Table"];

\(CreateWikiConnection[
"http://katlas.math.toronto.edu/w/index.php", 
"Scott", 
InputString["Enter Your Password"]
]\)

WikiUserName[]

WikiSetPageText["Invariant Definition Table", 
      InvariantDefinitionTable[
        DeleteCases[Invariants[], _RuleDelayed]]]