The answer depends on how you are associating properties with classes. There 
are 3 approaches and they have different semantics and syntax:

SHACL

:C1 sh:property [ sh:path :hasReaction;
                         sh:hasValue “abscess”].

Or equivalent that is not using a blank node

:C1 sh:property :C1-hasReaction;

:C1-hasReaction a sh:PropertyShape;
                        sh:path :hasReaction;
                        sh:hasValue “abscess”.

https://www.w3.org/TR/shacl/ 

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.

https://www.w3.org/TR/owl2-overview/ 

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.

https://www.w3.org/TR/rdf-schema/ 

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.

> On Apr 28, 2021, at 8:02 AM, [email protected] <[email protected]> 
> wrote:
> 
> Suppose we have classes named c1, c2,c3,c4 and c1 has property named 
> hasReaction, C2 has property name hasadverseReaction, C3 has property named 
> drugReaction.
>  My question is: firstly can different classes has same property name which 
> have diffrent values.
> 2nd question I wanted to retrieve all classes name which has some particular 
> reaction e.g. abscess. or all wanted to retrieve name of those classes which 
> has abscess as value of their property(hasReaction,  hasadverseReaction, 
> drugReaction) 
> Thanks 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "TopBraid Suite Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/topbraid-users/0bf89e78-0e6a-4ab0-82a0-8a660e427033n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/topbraid-users/0bf89e78-0e6a-4ab0-82a0-8a660e427033n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/EC0DB434-2FAF-4209-8007-48BC2BDDD27D%40topquadrant.com.

Reply via email to