Hi Emily,
the definition below doesn't look correct: you can only use sh:values
rules in a property shape, not in a class or node shape. Also, any such
rule would need to be attached to the class Patient because you want to
apply it to all instances of that class to infer an additional triple.
It may work better if you have something like
:Patient
sh:rule [
a sh:TripleRule ;
sh:subject sh:this;
sh:predicate rdf:type ;
sh:object p3point_validation:Patient ;
sh:condition [
# your sh:filterShape, i.e. start with sh:property
sh:property [
sh:path p3point_validation:point_dermfeatures ;
sh:in (
p3point_validation:Atypical
p3point_validation:Asymmetry
p3point_validation:Blue_white_structure
) ;
sh:maxCount 3 ; # Are those constraints really needed?
sh:minCount 2 ;
] ;
]
]
HTH
Holger
On 30/06/2020 13:14, Emily Zhang wrote:
Thanks so much for the detailed reply! I actually found out that sh:in
might be a better choice for me.
To give a summary of my question:
It's a inference question that all the instances of "Patient" who has
the property of "3point_dermfeatures" that satisfy the constrain: (a):
their features are within the range of "Atypical, Asymmetry,
blue_white_structure"; (b): the number of all the features are in the
range [2,3]; should be inferred to as having the disease of "Melanoma".
However, when I tried to "Run Inferences" for the instance of
"Patient", nothing returned. Do you think it has something to do with
my source code?
Here is the source code I've edited according to to tutorial.
p3point_validation:Melanoma
rdf:type owl:Class ;
rdf:type sh:NodeShape ;
rdfs:subClassOf owl:Thing ;
sh:values [
sh:filterShape [
sh:property [
sh:path p3point_validation:point_dermfeatures ;
sh:in (
p3point_validation:Atypical
p3point_validation:Asymmetry
p3point_validation:Blue_white_structure
) ;
sh:maxCount 3 ;
sh:minCount 2 ;
] ;
] ;
sh:nodes [
sh:path p3point_validation:Patient ;
] ;
] ;
.
在 2020年6月29日星期一 UTC-5下午7:04:49,Irene Polikoff写道:
Hi Emily,
I am not sure I understand the question. OWL is OWL and SHACL is
SHACL. They are different languages with different semantics. OWL
is based on the Open World Assumption and SHACL is not.
You can combine OWL axioms and SHACL constraints and rules in the
same RDF graph if this is what you mean by “using together”.
There are similarities between SHACL and OWL and you can find
constraint components in SHACL that are similar to certain OWL
restrictions. If your question is “what in SHACL would be similar
to the OWL allValueFrom and someValuesFrom restrictions", then:
For allValuesFrom, if values are resources, use sh:class - this
means that all values must be members of the specified class. If
values are literals, use sh:datatype.
OWL someValuesFrom is simply a short hand for a qualified
cardinality restriction with min = 1. In other words, at least one
value must satisfy the restriction, others could be different. In
SHACL, you could use qualified value shapes for something similar
to the qualified cardinality restrictions. See
https://www.w3.org/TR/shacl/#QualifiedValueShapeConstraintComponent
<https://www.w3.org/TR/shacl/#QualifiedValueShapeConstraintComponent>.
There is no short hand for someValuesFrom in the spec, we we have
defined dash:hasValueWithClass in the dash
(http://datashapes.org/dash) namespace. You can find it at
http://datashapes.org/dash.ttl
<http://datashapes.org/dash.ttl> and some documentation at
http://datashapes.org/dash.
You can also take a look at the mapping from OWL to SHACL that is
used by TopBraid to auto-generate SHACL from RDFS/OWL. It is
described in
https://www.topquadrant.com/from-owl-to-shacl-in-an-automated-way/
<https://www.topquadrant.com/from-owl-to-shacl-in-an-automated-way/>.
For the most up to date version of the rules, see the file in the
workspace.
Regards,
Irene
On Jun 29, 2020, at 6:47 PM, Emily Zhang <[email protected]
<javascript:>> wrote:
Hi Irene,
Just wondering if I can use SHACL and the OWL function
"allvaluesfrom" or "somevaluesfrom" together? I do see there is
"hasvalue" function embedded in the SHACL file, however, I didn't
find the other two functions.
Thanks,
Emily
--
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] <javascript:>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/topbraid-users/89d3bec0-016d-4696-80a0-73fa467cdf98o%40googlegroups.com
<https://groups.google.com/d/msgid/topbraid-users/89d3bec0-016d-4696-80a0-73fa467cdf98o%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]
<mailto:[email protected]>.
To view this discussion on the web visit
https://groups.google.com/d/msgid/topbraid-users/300044d2-bec1-49a5-85d2-c2de44bfd74fo%40googlegroups.com
<https://groups.google.com/d/msgid/topbraid-users/300044d2-bec1-49a5-85d2-c2de44bfd74fo%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/3414166d-b6e3-9ff9-518f-0dfab34cfeed%40topquadrant.com.