Ann
Ann

Reputation: 206

shacl validation error for a property which points to external file

data_file is at this url: https://schema.repronim.org/rl/activities/PHQ-9/items/phq9_8

I've written a shacl shape for the above data file. however, i get an error when i try to validate. In the above data file, the key responseOptions points to an external jsonld file -- which is when the error occurs. if i embed the external file in the data file itself, there is no error. I've used this shape for responseOptions:

 sh:property [
        sh:path reproterms:valueconstraints ;
        sh:or ( [ sh:nodeKind sh:IRI ] [ sh:node reproterms:ResponseOptionsShape ] ) ;
   ] .

The error thrown is:

Traceback (most recent call last):
  File "validation/test.py", line 146, in <module>
    serialize_report_graph=True)
  File "/Users/sanuann/envs/trial/lib/python3.7/site-packages/pyshacl/validate.py", line 259, in validate
    do_owl_imports=False)  # no imports on data_graph
  File "~/envs/trial/lib/python3.7/site-packages/pyshacl/rdfutil/load.py", line 110, in load_from_source
    first_char = source[0]
IndexError: string index out of range

Is the above shape correct? What am I doing wrong?

Upvotes: 0

Views: 249

Answers (1)

fkleedorfer
fkleedorfer

Reputation: 606

Your datatype constraint sh:datatype sh:IRI is off. The object of a sh:datatype triple must be an rdf datatype, such as xsd:string. I think you wanted to check for sh:nodeKind sh:IRI.

Upvotes: 1

Related Questions