SavingDiffPromptPlugin

From Protege Wiki
Jump to: navigation, search

Saving diff in Prompt

When Prompt compares two versions of an ontology, it generates a diff table. You can see this table on the Table View tab in Prompt results


When you press the disk button in the top right corner, the diff is written out to a file in a tab-delimited format (more or less replicating the table you see in the UI).


The easiest way to add a different output format is to write a Prompt plugin that adds another button to table view. When you click the button, the output on your format is generated. Here is what you need to do:

  • In a project plugin, attach a DiffAdapter (or DiffListener) to PromptDiff. The DiffAdapter should implement the following method:

public void diffTableViewBuilt (DiffTableView view, DiffEvent event);


  • You will get an event when that table view is created. You can then add your own button, for instance, by calling

view.addHeaderButton(new SaveInMyFormatAction (view));


For an example on how to implement SaveInMyFormatAction, you can look in the package edu.stanford.smi.protegex.prompt.eonExperiment that is distributed with the Prompt source code (but not used). Another example of the code that saves the diff to a file is in the TableRow class (saveToFile, saveToRDF).


Go back to PROMPT wiki page