sh:path :hasReaction;
sh:hasValue “abscess”.
OWL
:C1 rdfs:subClassOf [owl:onProperty :hasReaction;
owl:hasValue “abscess" ].
It is not customary to give the URI to OWL restriction, but instead of rdfs:subClassOf, one can also use owl:equivalentClass - depends on what they want to say.
RDFS
:hasReaction rdfs:domain :C1.
There are no local restrictions in RDFS and you could not say that it has value abscess. If abscess was a class, then you could use rdfs:range.
Can the same property have 2 different values? Yes, of course. However, with RDFS, if you say
:hasReaction rdfs:range :abscess.
:hasReaction rdfs:range :somethingElse.
It will mean that every instance that is a value of :hasReaction is BOTH, an instance of the class abscess and an instance of the class somethingElse. If you do not want to say this, then you must use owl:unionOf in the range.
If abscess was a class, then you would specify SHACL constraint and OWL restriction differently. in SHACL you use sh:class constraint or you could use sh:in and a complex path :hasReaction/^rdf:type.
In OWL you would use owl:allValuesFrom or owl:someValuesFrom restriction - depending on what you want to say.
For multiple values:
With SHACL, you could do something like:
:C1 sh:property [ sh:path :hasReaction;
sh:hasValue “abscess”].
:C1 sh:property [ sh:path :hasReaction;
sh:hasValue “somethingElse”].
With OWL, you would also specify two restrictions.
In all three cases, you are NOT saying that the class has reaction abscess. You are saying that instances of a class (if they exist) have reaction “abscess”.
You may need to consider if you really need to use classes or if you are building a controlled vocabulary of instances. Then, it becomes much simpler. You just say:
:C1 :hasReaction “abscess”. Or, most likely, you want to say that it is a resource:
:C1 :hasReaction :abscess.
:C1 :hasReaction :somethingElse.
Now that you see what triples associate a class with a property, you can formulate your SPARQL query. Keep in mind that if you are using classes and subclasses, you will probably want to retrieve in the query not only classes that have the constraints, but also their subclasses.