SetBrowserSlotPattern

From Protege Wiki
Revision as of 12:35, April 22, 2008 by TaniaTudorache (talk | contribs) (New page: = How to set the browser slot pattern to rdfs:label (or other property) using the API = Sometimes you may want to display the classes, properties and/or individuals in your ontology using...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

How to set the browser slot pattern to rdfs:label (or other property) using the API

Sometimes you may want to display the classes, properties and/or individuals in your ontology using the value of rdfs:label or some other property, rather than using the name, which might be a meaningless identifier. You can configure the Protege UI to use a different browser slot pattern (also referred to as browser slot) for the display of the entities. A users guide to do this for the UI mode is here.

The same functionality can be achieved in an external application that uses the Protege API and its UI components.

The code from below shows how to configure an application to use the rdfs:label for displaying the classes and properties. You may choose to replace rdfs:label with another property.

  OWLBrowserSlotPattern rdfsLabelBrowserPattern = new OWLBrowserSlotPattern(owlModel.getRDFSLabelProperty());
  //set rdfs:label as the browser pattern for owl:Class
  owlModel.getOWLNamedClassClass().setDirectBrowserSlotPattern(rdfsLabelBrowserPattern);

  //set rdfs:label as the browser pattern for rdf:Property
  owlModel.getRDFPropertyClass().setDirectBrowserSlotPattern(rdfsLabelBrowserPattern);