Re: pySHACL Question

I just answered an old but similar question on StackOverflow: https://stackoverflow.com/questions/53108262/shacl-sparql-targets-not-giving-correct-inference-while-using-pyshacl/60969316#60969316 <https://stackoverflow.com/questions/53108262/shacl-sparql-targets-not-giving-correct-inference-while-using-pyshacl/60969316#60969316>

Better to ask there as the answers are public.

Nick


> On 1 Apr 2020, at 8:49 pm, Nicholas Car <nicholas.car@surroundaustralia.com> wrote:
> 
> Hi James,
> 
> Something funny about that Gist: it doesn’t resolve!
> 
> Sorry but without that, I can’t retry your first command quoted below to try and replicate your output.
> 
> 
>> is it a best practice to always put everything into a single file?
> 
> Quite the opposite: my day-to-day use of pySHACL involves separate shape, ontology and data files. The SHACL playground [1] also expects the shape files to be separate from the data files.
> 
> 
> I will say that your SHACL shape results (which I can’t see the source files for since the gist is gone) should really have error messages in them so you can get some human-readable send of what’s through be a violation.
> 
> What do you see int eh data files where the errors are triggered in the all-in-one validation? Even whiteout human-redable error messages, you should be able to manually inspect the focus nodes (d:e4, d:e3 & d:e2) and see if you can determine whether they are should be failing. For example, it looks like d:e2 is missing 1+ hr:jobGrade.
> 
> 
> One final thing, a point of order: for this sort of question, you might be better off in StackOverflow tagged [shacl] [2] as it’s a use question (of a SHACL tool), rather than a SHACL dev question per se.
> 
> Cheers,
> 
> Nick
> 
> 
> 
> [1] https://shacl.org/playground/ <https://shacl.org/playground/> 
> [2] https://stackoverflow.com/questions/tagged/shacl <https://stackoverflow.com/questions/tagged/shacl> 
> 
> 
> 
>> On 30 Mar 2020, at 9:59 pm, James Hudson <jameshudson3010@gmail.com <mailto:jameshudson3010@gmail.com>> wrote:
>> 
>> Hello,
>> 
>> If this is not the appropriate forum for this question, please let me know.
>> 
>> I have a gist with all of the relevant files at: https://gist.github.com/James-Hudson3010/65be952d586859da380d949e7b520320 <https://gist.github.com/James-Hudson3010/65be952d586859da380d949e7b520320>
>> 
>> If I execute:
>> 
>> $ pyshacl -a -f human employees.ttl
>> 
>> I get the following, correct validation report...
>> 
>> Validation Report
>> Conforms: False
>> Results (3):
>> Constraint Violation in MaxInclusiveConstraintComponent (http://www.w3.org/ns/shacl#MaxInclusiveConstraintComponent <http://www.w3.org/ns/shacl#MaxInclusiveConstraintComponent>):
>>  Severity: sh:Violation
>>  Source Shape: hr:jobGradeShape
>>  Focus Node: d:e4
>>  Value Node: Literal("8", datatype=xsd:integer)
>>  Result Path: hr:jobGrade
>> Constraint Violation in DatatypeConstraintComponent (http://www.w3.org/ns/shacl#DatatypeConstraintComponent <http://www.w3.org/ns/shacl#DatatypeConstraintComponent>):
>>  Severity: sh:Violation
>>  Source Shape: hr:jobGradeShape
>>  Focus Node: d:e3
>>  Value Node: Literal("3.14", datatype=xsd:decimal)
>>  Result Path: hr:jobGrade
>> Constraint Violation in MinCountConstraintComponent (http://www.w3.org/ns/shacl#MinCountConstraintComponent <http://www.w3.org/ns/shacl#MinCountConstraintComponent>):
>>  Severity: sh:Violation
>>  Source Shape: hr:jobGradeShape
>>  Focus Node: d:e2
>>  Result Path: hr:jobGrade
>> 
>> However, if I split employees.ttl into three files containing the schema, shape, and instance data and run:
>> 
>> pyshacl -s shape.ttl -e schema.ttl -a -f human instance.ttl
>> 
>> the result is:
>> 
>> Validation Report
>> Conforms: True
>> 
>> I assume I am calling pyshacl correctly.
>> 
>> If there are other tools similar to pySHACL that allow me to split the shape, schema, and instance files, I would be interested in learning about them. Or, is it a best practice to always put everything into a single file?
>> 
>> Regards,
>> James
>> 
>> 
> 
> ______________________________________________________________________________________
>   
> Dr Nicholas Car
> Data Systems Architect
> SURROUND Australia Pty Ltd 
> Address P.O. Box 86, Mawson, Canberra ACT 2607
> Phone  +61 477 560 177 <tel:+61+414+99+55+43?utm_source=WiseStamp&utm_medium=email&utm_term=&utm_content=&utm_campaign=signature>
> Email  nicholas.car@surroundaustralia.com <mailto:nicholas.car@surroundaustralia.com>
> Website  https://surroundaustralia.com <https://surroundaustralia.com/>
> Enhancing Intelligence Within Organisations
> delivering evidence that connects decisions to outcomes
> 
> 
> 
> 
> 

______________________________________________________________________________________
  
Dr Nicholas Car
Data Systems Architect
SURROUND Australia Pty Ltd 
Address P.O. Box 86, Mawson, Canberra ACT 2607
Phone  +61 477 560 177 <tel:+61+414+99+55+43?utm_source=WiseStamp&utm_medium=email&utm_term=&utm_content=&utm_campaign=signature>
Email  nicholas.car@surroundaustralia.com
Website  https://surroundaustralia.com
Enhancing Intelligence Within Organisations
delivering evidence that connects decisions to outcomes

Received on Wednesday, 1 April 2020 10:59:06 UTC