sparql - Infer anonymous superclasses using SPIN rules

问题描述:

I am building an ontology in TopBraidComposer which has a class hierarchy and a couple of rules that work great on their own. In my ontology, I'm working on a class level, so all the definitions I create only relate to classes, not individuals. Now I want to infer subclass definitions like this one:

I tried the following SPARQL query which seemed to do the job:

Then I added said query as a SPIN rule to the owl:Thing class like this:

After pressing enter, it is automatically converted to the following form:

It looks reasonable but when I now start the inferencing process, it doesn't terminate anymore when it did before I added the test rule. When I force stop the reasoning, I can see that the desired triple has been added to the Test class numerous times.

How can I infer an anonymous superclass in SPIN?

Edit:

A workaround is to bind the restrictions to classes. The logic then seems to work but it doesn't show up like the anonymous superclasses do; neither in TBC nor in Protege.

网友答案:

After a long search, I found out the solution is really simple:

a simple check for an existing relationship will prevent an infinite loop: