0

I wrote a program to recursively identify all the subclasses of human and noticed that it got stuck in an infinite loop: human fetus and unborn child are subclasses of each other.

When I hear "subclass," I think of class hierarchies in object-oriented programming, where it doesn't make sense for two classes to be subclasses of each other. A compiler would throw an error. Do subclasses in Wikidata work differently, or did I find an error?

This help page says that the subclass property is transitive and that it

Is used to state that all the instances of one class are instances of another.

Nothing about this definition precludes X from being a subclass of Y if Y is already a subclass of X. Thus, if every human fetus is an unborn child and every unborn child is a human fetus, then it follows that they are subclasses of each other.

Perhaps people will dispute this particular example. But speaking generally, can two items be subclasses of each other? And if they can, does it follow that they are identical? That is, if all Xs are Ys, and all Ys are Xs, then does X = Y? (I see the human fetus is said to be the same as unborn child. It seems like their subclass relation implicitly says "yes, they are the same").

Also note the closely related human embryo, which shares the same relation with unborn child.

EDIT: I have since found that this is called a subsumption cycle. This page says:

A cycle is created if class A has a subclass B and B is a superclass of A.

Nothing else is said. There is neither an example nor an indication of whether these cycles are permitted. But perhaps this suggests that they are allowed.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.