Question

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".

Was it helpful?

Solution

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?

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top