Main FAQ for the Protégé Script plugin (3VK)
Main FAQ summary (3VL)
- History (3VM)
- Updating scripting languages (3VN)
- Modifying the default scripting language (3VO)
- Defining the path to a script that should be executed at each startup of the plugin (3VP)
- Available variables for interacting with Protégé (3VQ)
- Importing a remote script (3VR)
- Compiling scripts (3VS)
- Dynamically monitoring the changes on an ontology (adding/removing listeners) (3VT)
- Using the Protégé Script Tab for manipulating OWL ontologies (3VU)
- Creating or invoking user interface stuff from the Protégé Script plugin (3VY)
- Language-specific questions (3VZ)
Back to the Protégé Script plugin main page. (3W6)
Main FAQ Answers (3W7)
Updating scripting languages (3W8)
The code for the Protégé script plugin is completely independent from the various supported scripting languages. The distribution of the Protégé script plugin tries to include the latest vesions of these scripting languages, but we do not create a new version of the plugin everytime a new version of a scripting language is released. (3W9)
It is very simple to update a scripting language, though: just replace the old jar file(s) by the new one(s) in the ${PROTEGE_HOME}/plugins/edu.stanford.smi.protege.script directory. You can also send me an email so that I don't forget to include the new version in the next release of the Protege script plugin. (3WA)
Modifying the default script language (3WB)
Edit the Protege.lax file in the main installation directory of Protégé and add the following line at the end: (3WC)
# DEFAULT SCRIPT LANGUAGE # ----------------------- edu.stanford.smi.protege.script.defaultScriptLanguage=jython (3WD)
Replace "jython" by any of "jython", "perl", "beanshell", "groovy", "jruby". (3WE)
Defining the path of a script to be executed at each startup of the script plugin (3WF)
Edit the Protege.lax file in the main installation directory of Protégé and add the following line at the end: (3WG)
# PATH TO THE DEFAULT SCRIPT FILE # ------------------------------- edu.stanford.smi.protege.script.defaultScriptPath=/home/olivier/misc/python/protegeAutomaticScript.py (3WH)
Notes: (3WI)
- This can be useful for setting automatically the path where the script engine should look for java classes or modules (i.e. the sys.path for Python; cf this script) (3WJ)
- Windows users should remember to double the backslashes (3WK)
Available variables for interacting with Protégé (3WL)
- kb: represents the knowledge base. It is an instance of edu.stanford.smi.protege.model.KnowledgeBase and of edu.stanford.smi.protegex.owl.model.OWLKnowledgeBase for OWL ontologies. (3WM)
- scriptTab: represents the scripting tab. This variable can be useful for accessing other tabs (check with Ray how to do this and add to FAQ). (3WN)
- console: represents the console. It is an instance of ScriptConsole (add link to javadoc). (3WO)
Importing a remote script (3WP)
It is definitely possible to import or execute remote script from the Protégé Script Tab. For further details, checkout the FAQ specific to your script language: python, perl .... (3WQ)
Creating or invoking user interface stuff (3WR)
You can either use the Java Swing API or some script language specific libraries. (3WS)