DefiningTagValues - mdebellis/SemanticKG-Design GitHub Wiki

Defining Tag Values

This exercise shows why OWL individuals are often better than strings for modeling tags. You will add a profession value for Alan Turing in two different ways: first as an object property value, and then as a string value.


➤ Step 1: Open Alan Turing in the People Ontology

Open the People Ontology in Protégé.

Go to the:

Individuals by class tab

In the Class hierarchy view in the upper-left corner:

  1. Expand Agent.
  2. Click Person.

In the Individuals view below the class hierarchy, you should see Alan Turing as one of the individuals of Person.

You can also use the search icon in the upper-right corner of Protégé, the magnifying glass, to search for him directly.

Click Alan Turing.

The Property assertions view in the lower-right corner shows the values asserted about him.


➤ Step 2: Add an Object Property Assertion

In the Property assertions view, click the + next to:

Object property assertions

This opens the interface for adding a value to an object property.

In the object property field, type:

'has p

Then press:

Ctrl+Space

✅ Be sure to include the initial single quote character and do not put an underscore between has and p.

The single quote matters because Protégé distinguishes between completion for an IRI and completion for a label. Since most entities you work with have labels, most of the time you should start with the single quote character when using autocomplete.

Because more than one object property starts with the label has p, Protégé should show a menu of possible completions.

Select:

has profession role


➤ Step 3: Try to Enter an Invalid Object Property Value

Now move to the value field on the right.

Type:

'Cmp

Then press:

Ctrl+Space

Nothing should complete.

Try entering Cmp as the value anyway.

Protégé will not allow it. The reason is that has profession role is an object property, so its value must be an OWL individual. Cmp is not the name or label of an individual in the ontology.

Now type:

'Com

Then press:

Ctrl+Space

Protégé should offer:

Computer Scientist

Select Computer Scientist as the value.

✅ You have now added a profession tag as a controlled OWL individual rather than as an arbitrary string.


➤ Step 4: Add a Data Property Assertion

Now look just below the object property assertions for Alan Turing.

Click the + next to:

Data property assertions

The interface is a bit different for data properties. You will see a tree with the data properties under:

topDataProperty

Navigate to the data property:

profession_string

Select it.

In the value field, type:

Cmp

Then press:

Ctrl+Space

Nothing happens, as expected.

Now try entering:

Cmp

This time Protégé allows it.


➤ Step 5: Compare Individuals and Strings as Tags

What you have just seen illustrates why OWL individuals can be better than strings for tags.

When tags are modeled as individuals, you have a well-defined set of allowable values. If you try to enter a tag that is not an existing entity, Protégé will not let you enter it as the value of an object property.

When tags are modeled as strings, you can enter any arbitrary text as a tag. That can be useful, but it also makes spelling errors, inconsistent abbreviations, and duplicate meanings much easier to introduce.

Protégé does not exploit the individual-based approach as much as it could. It checks that the value is an individual, but a custom user interface could go further. For example, you could require that values for tag properties must not only be individuals, but individuals of the appropriate class. You could also make it easy for authorized users to add new tags, store them immediately in the knowledge graph, and make them available to other users.


➤ Step 6: When String Tags Are Still Useful

This does not mean that tags should always be modeled as OWL individuals. There are also good reasons to model tags as strings:

  1. String tags are usually easier and faster to add, rename, and delete.
  2. Most current systems use string tags rather than OWL individuals.

The choice depends on the goals of the system. If tags need to support reasoning, validation, consistency checking, or controlled vocabulary management, individuals are usually a better choice. If tags are informal, user-generated, or need to change very quickly, strings may be more practical.


➤ Step 7: Combining Tags with Class Definitions

At the conceptual level, we can also combine these approaches.

For example, in the People Ontology, gender is modeled as a tag. But the ontology also defines classes using that tag, such as:

Man ≡ Adult and ('has gender' value Male)

and:

Girl ≡ Child and ('has gender' value Female)

This lets us use tags as controlled values while still defining meaningful OWL classes from those values.


Bottom Line

When a tag is modeled as an OWL individual, tools can help restrict values to a controlled set of entities. When a tag is modeled as a string, users can enter arbitrary text. Both approaches are useful, but they support different design goals.