Consider the following instance of SomeClass
:
instances:some_thing1
a semapi:SomeClass ;
semapi:hasChainTo (
[ ... ] [ ... ] [ ... ]
) .
I need every instance (some_thing2
, some_thing3
, etc.) to have its hasChainTo
property point at the same list of blank nodes (as in there is only one copy of it). I need to maintain the list of blank nodes syntax because the chains get very deep and this syntax is very fluid for writing out each chain (for SomeClass2
, SomeClass3
, etc.).
If I simply make a base class and subClassOf from it, the hasChainTo
property inherits but not the object it's pointing to. This intuitively makes sense but I need the other behavior.
How can this be accomplished?
If you want to refer to the same thing from multiple nodes in the graph, you should give it a URI. It doesn't have to be a full http:
URI - you could use a UUID:
instances:some_thing_1
semapi:hasChainTo <urn:uuid:12345>.
instances:some_thing_2
semapi:hasChainTo <urn:uuid:12345>.
instances:some_thing_3
semapi:hasChainTo <urn:uuid:12345>.
<urn:uuid:12345>
semapi:chain (
[ .. ] [ .. ] [ .. ]
).
Don't confuse RDFS/OWL sub-classes with inheritance of state and behaviour in object-oriented languages. The class hierarchy in RDFS is for classifying nodes - i.e. assigning them to a class, where a class is some set of resources. There is no direct equivalent of the code-reuse you get from inheritance in languages like Java.