I have a gist with all of the relevant files at: https://gist.github.com/James-Hudson3010/2588d9b17dd33e15922122b8b5cf1bd7
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):
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):
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):
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.
When you use the individual files, pySHACL has no way of knowing what to associate your Shape file's hr:Employee
NodeShape with. It seems to know when it's in that single file (perhaps it runs against all classes in the file??).
So:
hr:Employee
class name: hr:EmployeeShape
sh:targetClass
directive:hr:EmployeeShape
a sh:NodeShape ;
sh:targetClass hr:Employee ;
sh:property hr:nameShape ;
sh:property hr:jobGradeShape .
Then the multi-file call gives the same result as the single file call.
Your calls to pySHACL are correct!