Emily,

If you have a shape like this

> p3point_validation:Patient a owl:Class, sh:NodeShape
>     sh:rule [
>         a sh:TripleRule ;
>         sh:subject sh:this;
>         sh:predicate rdf:type ;
>         sh:objectp3point_validation:Melanoma;
> 
>         sh:condition [
>           sh:property [
> 
>               sh:path p3point_validation:point_dermfeatures ;
> 
>               sh:in (
> 
>                   p3point_validation:Atypical
> 
>                   p3point_validation:Asymmetry
> 
>                   p3point_validation:Blue_white_structure
> 
>                 ) ;
> 
>               sh:minCount 2 ;
> 
>             ] ;
>         ]
>     ]
> 


And you have an instance of p3point_validation:Patient with some of the listed 
values for the p3point_validation:point_dermfeatures property, you will get 
this inference - provided that the patient has at least 2 values for the 
property.

I do not understand what you meant by "it only provided examples for the EDG 
version”. EDG version of what? 

EDG performs these inferences so yes, everything you see is for EDG.

How are you running the inferences? You need to go to the Transform tab in EDG 
to execute.

If you wanting to invoke inference execution programmatically, then, as 
explained in the slides, you need to script it. You will need to write a script 
that will call the SPARQLMotion module - again, explained in the slides. This 
would be either SWP or SPARQLMotion script, but to do so, you will need to get 
familiar with these scripting technologies and it will take you some time. I 
doubt that we will be able to get you successfully through this learning curve 
just by using this mailing list. It will need you to take some 
training/mentoring.

GraphQL example in the slides was to show that if you are using sh:values to 
infer property values, a dynamically inferred value of a property will be 
available to the GraphQL query. Sh:values inferences get computed on the fly 
and they do not need any triggering. For your example, however, we are not 
using sh:values. So, this is irrelevant to your particular example. 

Inferred values will be available to SPARQL queries as well. But again, this is 
unconnected to what you are currently trying to accomplish.

One reason we are not using sh:values for your example is that you are trying 
to infer the type of a resource. A property backed by sh:values rule is 
protected from edits. It is always system generated on a fly. We would not want 
this for rdf:type since when you create a new resource, you specify its type. 

Another approach is not to infer rdf:type Melanoma for the patient. Instead, 
create a new property e.g., :diagnosis and infer :diagnosis :Melanoma. After 
all, a patient is not melanoma, he has melanoma, but he is not a disease, he is 
a person.

If you do this, then you will be able to use sh:values. And then, the inference 
will happen on the fly. You will be able to get the inferred value in a GraphQL 
query as explained in the slides. To get it in a SPARQL query, you need to use 
tosh:values. See https://www.topquadrant.com/graphql/values.html 
<https://www.topquadrant.com/graphql/values.html> for an example of a SPARQL 
query to retrieve dynamically inferred values.




> On Jun 30, 2020, at 12:40 PM, Emily Zhang <zxy1033...@gmail.com> wrote:
> 
> Thanks, Hogler! I've revised the code accordingly, however, when I "Run 
> Inference" against the instance of "Patient", still nothing returned. I am 
> wondering whether that's because I should write a GraphQL/SPARQL query for 
> inference? I've read the slides provided by Irene, very helpful, thank you! 
> But it only provided examples for the EDG version. It did provide example for 
> GraphQL query, but I am using SHACL file right now, and I think it only 
> contains the SPARQL query function. 
> 
> 在 2020年6月29日星期一 UTC-5下午10:54:59,Holger Knublauch写道:
> Oh I guess I made a copy and paste mistake. Change the line to sh:object 
> p3point_validation:Melanoma because that's the rdf:type you want to infer?
> 
> Holger
> 
> 
> 
> On 30/06/2020 13:53, Emily Zhang wrote:
>> Thank for the quick reply, Holger! It make sense that I should define the 
>> rule under Patient class. However, how can I link the rule to "Melanoma" 
>> since its the the instance of patient should be inferred as? Should I define 
>> the "melanoma" as the sh:node under sh:filtershape?
>> Thanks again,
>> Emily
>> 
>> 在 2020年6月29日星期一 UTC-5下午10:30:58,Holger Knublauch写道:
>> 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.
>>> 
>>> 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 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/. 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 <zxy10...@gmail.com> 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 topbrai...@googlegroups.com.
>>>> To view this discussion on the web visit 
>>>> https://groups.google.com/d/msgid/topbraid-users/89d3bec0-016d-4696-80a0-73fa467cdf98o%40googlegroups.com.
>>> 
>>> -- 
>>> 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 topbrai...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/topbraid-users/300044d2-bec1-49a5-85d2-c2de44bfd74fo%40googlegroups.com.
>> -- 
>> 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 topbrai...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/topbraid-users/d5d89d89-0fb2-4af6-883d-a453c5f6257do%40googlegroups.com.
> 
> -- 
> 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 topbraid-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/topbraid-users/49c2c4eb-85dc-4009-b52d-a4c73a3e2e74o%40googlegroups.com.

-- 
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 topbraid-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/DB1B439F-2FD4-40AA-A98D-61B68ED847C1%40topquadrant.com.

Reply via email to