You're probably working in RDF(S), and not in OWL, but if you do have the ability to use OWL based tools, and for the sake of anyone who finds this question and can use OWL based tools, here's an OWL-based answer.
If you want every instance of a class (including instances of its subclasses) to have some property value in common, you can use an Individual Value Restriction. In the Manchester syntax, you can say that instances of SomeClass
all have the value sharedIndividual
for the propery hasValue
by the axiom:
SomeClass SubClassOf hasValue value sharedIndividual
Then every instance of SomeClass
has the type hasValue value sharedIndividual
, which means that the instance has sharedIndividual
as a value for the hasValue
property.
Here's the N3 serialization of an ontology with a class SomeClass
and two subclasses SomeSubClass
and AnotherSubClass
. Each of the three classes has a declared individual. The type hasValue value sharedIndividual
is a superclass of SomeClass
.
@prefix : <http://www.example.com/valueClassExample#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
<http://www.example.com/valueClassExample>
a owl:Ontology .
:hasValue
a owl:ObjectProperty .
:sharedValue
a owl:Thing , owl:NamedIndividual .
:SomeClass
a owl:Class ;
rdfs:subClassOf
[ a owl:Restriction ;
owl:hasValue :sharedValue ;
owl:onProperty :hasValue
] .
:SomeSubClass
a owl:Class ;
rdfs:subClassOf :SomeClass .
:AnotherSubClass
a owl:Class ;
rdfs:subClassOf :SomeClass .
:SomeClassInstance
a :SomeClass , owl:NamedIndividual .
:SomeSubClassInstance
a owl:NamedIndividual , :SomeSubClass .
:AnotherSubClassInstance
a owl:NamedIndividual , :AnotherSubClass .
With this ontology loaded in Protégé and with Pellet attached for reasoning, asking which individuals have sharedValue
as a value of the hasValue
property shows all the individuals.
SomeClass SubClassOf semapi:hasChainTo value <urn:uuid:12345>
, which means that each instance ofSomeClass
does in factsemapi:hasChainTo <urn:uuid:12345>
(and "each instance" includes instances of subclasses). – Nebuchadnezzar