I'm actually trying to create a RDFS model and wondering if there's a way to declare a class to have a single instance.

The scheme designed is for a kind of graph and I want to design a single node as "root". Should I use a sub-class or a property ? I know OWL offers more semantic vocabulary but I intend on staying "basic".

有帮助吗?

解决方案

No, you can't do that in RDFS. I'm also not sure whether it would be a useful thing to do. Just define your class and declare the single resource as having that class as its type. What's the benefit of asserting that there can be no other resources having that type?

其他提示

My impression, reading your "use case", is that you'd rather like a functional property :hasRoot, such that a thing can only have one root. As cygri said, this cannot be done in pure RDFS but a simple fragment of OWL is sufficient:

:hasRoot  a  owl:FunctionalProperty .

Then, for a given entity x, there can only be a single entity y such that the relationship x :hasRoot y holds. Then, if you have the following data:

:x  :hasRoot  :y .
:x  :hasRoot  :z .

you can conclude that:

:y  owl:sameAs  :z .

Yet, in most of the cases, this kind of reasoning is not needed and what cygri suggests is sufficient and simpler, as long as your application ensures that a single root is ever defined.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top