Deriving human-readable labels with SPIN
I know, it took me ages to get there, but TopBraid Composer 3.0.0 beta 2 finally introduces the ability to switch the whole user interface to display human-readable labels instead of resource identifiers such as qnames. There is a button in the tool bar that instructs TopBraid to use any values of rdfs:label or sub-properties thereof, and otherwise fall back to qnames. For example, in the following screen shot, Alfred Tucker's wife is displayed as "Kym Smith" instead of "kennedys:KymSmith".
I believe the lack of this (trivial looking) feature has been a major disappointment for people coming from Protege or comparable tools :) Anyway, now that we have this feature in, let's do something cool with it. You may notice that the Kennedy ontology above contains three naming properties: first name, last name and name, where name can basically be derived by concatenating first and last names. In the kennedys.owl that is found in the examples folder of TBC, the name property has been asserted and manually maintained by the editors. A smarter way is to use a SPIN rule to do this maintenance work for us:
Here, the spin:rule gets the current values of firstName and lastName for the given instance of Person (?this), creates a full string (?name) using a SPARQL built-in function call, and then infers this ?name as value for the name property. Turn on incremental SPIN inferencing and the value will update after each change.
The beauty of this approach is that you can now use arbitrary SPARQL expressions to derive labels. And, as we all know, SPARQL is very expressive and becomes even more expressive every day...
0 Comments:
Post a Comment
<< Home