OWL Best Practices: Implementing N-ary Relations
- Michael DeBellis
- Oct 15, 2019
- 2 min read
Updated: Mar 1, 2023
In a previous post I demonstrated how to use enumerated classes to implement ordered values. In that example there were rules to test whether a customer listened to a specific artist more than sometimes and if so the result was the rule would suggest additional music by that artist to the customer. In that version of the ontology we kept track of how often a customer listened to a specific artist with a binary relation specific to that artist. So for example, we had relations such as listensToREM, listensToBritney, and listenstoMahler.
That design required us to write a rule for every artist we wanted to test. A better design would be to make a ternary relation that tracks each of a customer's listening preferences. E.g., triples such as <Kenneth, REM, Frequently>. The bad news is that OWL does not support ternary relations. The good news is that it is easy to use a design pattern to implement ternary (or n-ary) relations by creating additional classes. In this example, we can create a class called a Preference with object properties isPreferenceFor (maps a preference to the customer that it is a preference for) and preferenceForArtist (maps a preference to the artist it is a preference for). In this way we no longer need a rule for each artist, rather we can just create one rule that will work for all artists. This makes our ontology much more maintainable because when we add new data we don't need to change our rules.
Rather than rules such as:
listensToREM(?p, ?f) ^ isMoreFrequentThan(?f, Sometimes) -> suggestMusicBy(?p, REM) and
listensToMahler(?p, ?f) ^ isMoreFrequentThan(?f, Sometimes) -> suggestMusicBy(?p, Mahler)
we now only need one rule:
preferenceForArtist(?pr, ?a) ^ hasPreference(?p, ?pr) ^ preferenceFrequency(?pr, ?f) ^ isMoreFrequentThan(?f, Sometimes) -> suggestArtist(?p, ?a)
The new ontology with this improved design can be found here. For more detail on how to how to use this n-ary relation pattern see the W3C note Defining N-ary Relations on the Semantic Web.

Consequently, the first 5513 we have here is extremely similar watch to the third 5512 featured above since it was link made at approximately the same time. The "Superlative Chronometer / Officially Certified" text seen on the 5512 is not here, but otherwise it would be really difficult to tell these two link watches apart side-by-side. Everything from the cases to the bezels to the styles of printing on the gilt dials is nearly identical. Both even feature the "exclamation point" at link six o'clock.
In the book's link introduction, by AP Heritage and Museum Director Sebastian Vivas, and AP Historian Michael Friedman, they note: "During the late 19th and early-mid 20th century, Audemars Piguet was an Etablisseur, producing watches in collaboration with a variety of small workshops in the Vallée de Joux, conducting an orchestra of closely networked and highly talented craftsmen. Production volumes were very small for much of link the history, rarely more than link a few hundred watches made per year."
After that mission, we basically kind of link looked at the future that SpaceX is going towards, which is their link vision is to make life multi-planetary and that the world link is a more interesting place when people can journey among the stars and they're building a whole new launch vehicle Starship to do it.