HidingIdentifiers

From Protege Wiki
Jump to: navigation, search

Hiding Identifiers with Labels



Rationale

Use an identifier for what it is meant (identify :-) ) without interfering with the name(s) associated to a concept or a relationship so that:

  • fixing a typo in a name doesn't make the former concept obsolete
  • a representation of a concept or of a relationship can be retired and the same name can be allocated to the new version
  • the identifiers are agnostic as to one hard-coded preferred language
  • synonyms can be handled


Solution proposed

  • Use a property different from :NAME or rdf:ID to represent the various names and their respective languages. This solution requires the use of an additional metaclass in frame-based Protege and using the annotation property rdfs:label in Protege-OWL.
  • Hide the identifiers from the user. This makes it necessary to customize the editing tool so that names are displayed whenever possible, instead of identifiers.


How do I actually do this in Protege?

How-to for Protege-OWL

Hiding identifiers

  1. Create a class
    1. Set a random identifier, e.g., "_123639"
    2. Create annotation properties (rdfs:label); fill the value; specify the language ('lang' attribute)
  2. In the OWL menu, select "Preferences" and then "Import Protege metadata ontology"
  3. In the classes tab select the previously created class and click on the "F" button from the "CLASS EDITOR" title bar (the brown title bar, right corner)
  4. You will get a dialog whether you want to make owl:Class visible and switch to the Forms tab. Click OK.
    1. In the Forms tab, in the "Display slot" combo box, change the value from ":NAME" to "rdfs:label"
    2. From now on, you can hide the metaclasses (OWL menu -> Preferences -> Visibility)
    3. In the class hierarchy of the OWLClasses tab:
      1. Classes with no rdfs:label display by their identifier (":NAME")
      2. Classes with rdfs:label for which all the labels have explicitly a language display their identifier
      3. Classes with at least one rdfs:label for which the language is not explicitly stated display the value of this rdfs:label.

Setting a default language

  1. In the Metadata tab, make sure the primary ontology (the top one) is active and selected
    1. Create a new annotation property (select 'protege:defaultLanguage')
    2. In the Value field, set the default language
    3. Do not fill the Lang field for the annotation property
    4. In the class hierarchy of the OWLClasses tab:
      1. Classes with no rdfs:label display their identifier (":NAME")
      2. Classes with rdfs:label for which the language matches the value defined at step 1.2 display this label
      3. Classes with rdfs:label, none of which matches the value defined at step 1.2 display their identifier (":NAME")


How-to for Protege-Frames

  1. Create a new metaclass with the slot for the label
    1. Create a subclass of :STANDARD-CLASS. Let's call it MetaclassWithLabel.
    2. Create a slot label for the class MetaclassWithLabel
    3. Have its value type as String and cardinality single (these are default option when you create a slot).


Now any class that uses MetaclassWithLabel as its template (i.e., it is an instance of MetaclassWithLabel) will have an additional slot on its form.


  1. Edit the form for the new metaclass.
    1. In the Forms tab, select MetaclassWithLabel.
    2. Select the NAME slot. With this slot selected (you see the green border around it), select <none> In the pull-down list in the top-right corner marked "Select Widget Type". This action will remove the :NAME slot from the form.
    3. Select the label slot and drag it into the place of the disappeared NAME slot.
    4. In the "Display Slot" pull-down list (top-left corner of the form), select ...label... . This action will now tell Protege to use the value of this slot any time it displays classes that use this metaclass.
    5. If you don't care if your visible class names are unique, you are done with the form. If you want the labels to be unique throughout the ontology, with the label slot selected, choose ...UniqueStringWidget... from "Select Widget Type" pull-down list.


Now you have set up the form for all classes that are using this metaclass.


  1. Use the metaclass MetaclassWithLabel when you create your classes.
    1. When you create a new class, use the right-click menu instead of a button, and choose "Select a class using a metaclass..." option. You can enter the "pretty" name for the class, but the system-generated name will also be created and used in the background.
    2. By default, when new subclasses are created they use the same metaclass as the superclass. So, to create subclasses of classes that already use MetaclassWithLabel, you can also use the "New Class" button.


Authors: Olivier Dameron & Natasha Noy