Difference between revisions of "BeanshellView"

From Protege Wiki
Jump to: navigation, search
(Added some examples)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{Plugin
 
{{Plugin
|Description=Some coding just doesn't justify setting up an entire java build environment. Some coding requires immediate feedback. Using the Beanshell view, any user can now access the power of the P4 to query and manipulate ontologies or even interact with the UI.
+
|Description=Some coding doesn't justify setting up an entire Java build environment and/or requires immediate feedback. The Beanshell view allows programmatic access from within Protege for querying and manipulating ontologies, or even interacting with the UI. For more information see the Beanshell website.
 
 
Most of P4 can be accessed from the OWLEditorKit or OWLModelManager (variables eKit and mngr respectively).
 
 
 
For more information see the Beanshell Website
 
 
|PluginType=View
 
|PluginType=View
 
|ForApplication1=Protege-OWL
 
|ForApplication1=Protege-OWL
 
|Screenshot=P4-scripting-UI.png
 
|Screenshot=P4-scripting-UI.png
|HomepageURL=http://www.co-ode.org/downloads/protege-x/plugins/#scripting
+
|HomepageURL=http://code.google.com/p/co-ode-owl-plugins/wiki/BeanshellView
 
|DeveloperID1=Nick Drummond
 
|DeveloperID1=Nick Drummond
|LastUpdated=November 14, 2008
+
|DeveloperID2=Timothy Redmond
 +
|LastUpdated=March 4, 2010
 
|Topic1=Semantic Web
 
|Topic1=Semantic Web
 
|Topic2=Software Engineering
 
|Topic2=Software Engineering
 
|License=LGPL
 
|License=LGPL
|Affiliation1=CO-ODE
+
|Affiliation1=The CO-ODE Project
 
|Affiliation2=The University Of Manchester
 
|Affiliation2=The University Of Manchester
 
}}
 
}}
== Examples ==
+
<br style="clear: both;" />
 
 
Here are some code examples you could try
 
 
 
=== Creating a new class in the current ontology ===
 
 
 
  ont = mngr.getActiveOntology();
 
  fac = mngr.getOWLEntityFactory();
 
  changes = fac.createOWLClass("myNewClass", ont.getURI());
 
  mngr.applyChanges(changes.getOntologyChanges());
 
 
 
=== Check if the current ontology is valid OWL DL ===
 
 
 
  import  org.semanticweb.owl.profiles.*;
 
  dlProfile = new OWLDLProfile();
 
  ont = mngr.getActiveOntology();
 
  dlProfile.checkOntology(ont, mngr.getOWLOntologyManager());
 
  report = dlProfile.checkOntology(ont, mngr.getOWLOntologyManager());
 
  print(report.isInProfile());
 
 
 
  nonDLConstructs = report.getDisallowedConstructs();
 
  for (c : nonDLConstructs) {
 
  print(c);
 
  }
 
 
 
=== Pick a class to use in a script ===
 
 
 
  uiHelper = new UIHelper(eKit);
 
  c = uiHelper.pickOWLClass();
 
  print(c);
 
 
 
=== Use a reasoner ===
 
 
 
First make sure a reasoner has been selected and the ontology is classified.
 
 
 
  import org.semanticweb.owl.inference.*;
 
  r = mngr.getReasoner();
 
  c = // get your class here - for example as above
 
  subs = OWLReasonerAdapter.flattenSetOfSets(r.getSubClasses(c));
 
  print(subs);
 
 
 
Note the use of OWLReasonerAdapter as the reasoners return equivalence sets.
 

Latest revision as of 16:37, April 22, 2011

BeanshellView

by Nick Drummond, Timothy Redmond

Screenshot

Type View
Author(s) Nick Drummond, Timothy Redmond
Last Update March 4, 2010
License LGPL
Homepage BeanshellView website
For Application
Topic(s)
Affiliation

Some coding doesn't justify setting up an entire Java build environment and/or requires immediate feedback. The Beanshell view allows programmatic access from within Protege for querying and manipulating ontologies, or even interacting with the UI. For more information see the Beanshell website.

Versions & Compatibility

This section lists available versions of BeanshellView.

VersionCompatible withDependencies
BeanshellView 1.1.1Protege-OWL 4.2
Protege-OWL 4.1
BeanshellView 1.0.0Protege-OWL 4.0

If you click on the button below to add a new version of BeanshellView, you will be asked to define a page title for the new version. Please adhere to the naming convention of BeanshellView X.X.X when you define the new page!

Changelog

VersionChanges in this version
BeanshellView 1.1.1see page for more details
BeanshellView 1.0.0see page for more details