Search code examples
rdfsemantic-webshex

Why isn't a ShEx constant matching the same term in the data?


I have a ShEx schema expecting a specific type:

epri:VariableShape {
  a st:studyVariable ;
  st:subject [tax:~] ;
  st:signal xsd:decimal
}

which rejects data with that type

st:envFactorEMF a st:studyVariable ; # << this isn't recognized
  st:subject tax:1758 ;
  st:signal -.00043 .

(demo) Why would that be?


Solution

  • The error message from the demo that you linked to actually describes the exact problem.

    Error validating http://www.epri.com/studies/3002011786studyVariable as {"type":"NodeConstraint","datatype":"http://www.epri.com/studies/3002011786studyVariable"}: mismatched datatype: http://www.epri.com/studies/3002011786studyVariable is not a literal with datatype http://www.epri.com/studies/3002011786studyVariable

    You're using a datatype constraint, which isn't what you want.

    You need to use a [ st:studyVariable ], instead, since you want to specify a value set:

    epri:VariableShape {
      a [ st:studyVariable ];
      st:subject [tax:~] ;
      st:signal xsd:decimal
    }