Metaphor Example




Let's use the metaphor server to compute something. Say we have a small piece of the authorship graph: Scott has written two things, called Metaphor and Omath, and David is also an author of Metaphor. We'd like to check that there's just one connected component of the coauthor graph.

To do this, we just need to compute the colimit of the dataset described above, which we'll achieve by computing the left pushforward to the terminal category *.

First we need the dataset. At present, the easiest way to enter this is as CSV (comma separated values), somewhere on the internet. Let's put it up at pastebin. (This link gives a pretty user interface at pastebin, but you can also ask for the raw data http://pastebin.com/raw.php?i=FWQrHMpY, and we'll need that URL in a moment.) The second and third tables given there are sort of redundant; later we'll relax the requirement to give explicity these 'data' tables.

Now we need to ask metaphor to parse and load this dataset. The URL you need is /metaphor/load/dataset/CSV?url=, supplying the CSV URL above as the parameter value. In fact, rather than copying and pasting the URL above, you could visit /metaphor/help, which gives a primitive interface to all the functionality of the metaphor server. Scroll down until you find /metaphor/load/dataset/CSV, and paste in the pastebin URL above. You should now see a page showing that dataset in metaphor's JSON format. (One day, someone might implement a graphical interface for displaying such things.)

Note that this dataset has an underlying ontology (its source field), which has been automatically extracted from the CSV data. In fact, you can ask metaphor to extract the source ontology for you; just pass the url of your dataset to /metaphor/dataset/source?dataset=, e.g. as /metaphor/dataset/source?dataset=%2Fmetaphor%2Fload%2Fdataset%2FCSV%3Furl%3Dhttp%253A%252F%252Fpastebin.com%252Fraw.php%253Fi%253DFWQrHMpY. Let's call this ontology the 'authorship ontology'.

Next we need to define the translation from the authorship ontology to the terminal ontology. Unfortunately there's no help for writing down this definition at present; we just have to enter the JSON 'by hand'. You can do this at /metaphor/store: enter some JSON, and hit submit. Of course, you should cheat by looking /metaphor/store/translation?hash=e9963be834d8e4446d44a8b40d28a8a31f7ec89 to see what I wrote when I first did this.

Finally, we're all ready to compute our pushforward. Find /metaphor/compute/leftPushforward over at /metaphor/help, and enter the URLs above (for the loaded dataset and the translation) into the field. Alternatively just go directly to /metaphor/compute/leftPushforward?translation=%2Fmetaphor%2Fstore%2Ftranslation%3Fhash%3De9963be834d8e4446d44a8b40d28a8a31f7ec89&dataset=%2Fmetaphor%2Fload%2Fdataset%2FCSV%3Furl%3Dhttp%253A%252F%252Fpastebin.com%252Fraw.php%253Fi%253DFWQrHMpY.

To interpret this result, observe it's a dataset on an ontology with just one object, and no arrows. It's thus really just a set, and the mathematics says this is the colimit of our original dataset. (Recall, left push-forward to the terminal category is colimit, right push-forward to the terminal category is limit.) In this case, if you look at the actual set, you'll see it just has one object, confirming our expectation that the co-authorship graph should be connected.