Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hard to understand output for simple schema #272

Open
EmmanuelOga opened this issue Apr 26, 2020 · 3 comments
Open

Hard to understand output for simple schema #272

EmmanuelOga opened this issue Apr 26, 2020 · 3 comments

Comments

@EmmanuelOga
Copy link

EmmanuelOga commented Apr 26, 2020

Hi,

I'm trying to validate example 26 in the Shex chapter of the validating RDF book.

I'm using the shapemap :emily@:User. I know that the problem is that according to the schema users should have exactly one name, but emily's RDF data lists two names. The output I get is the following:

Error: Attempt: node: :emily, shape: :User Candidate line [((<http://schema.org/name>,"Emily"),C0),((<http://schema.org/name>,"Emilee"),C0),((<http://schema.org/gender>,<http://schema.org/Female>),C2)] which corresponds to {\| C0 -> 2, C2 -> 1 \|} does not match C0,C1?,C2,C3*Table:Constraints: C3->Pos(ShapeAnd(None,List(NodeConstraint(None,Some(IRIKind),None,List(),None,None,None), ShapeRef(IRILabel(<http://example.org/User>),None,None)),None,None),None),C2->Pos(ShapeOr(None,List(NodeConstraint(None,None,None,List(),Some(List(IRIValue(<http://schema.org/Male>), IRIValue(<http://schema.org/Female>))),None,None), NodeConstraint(None,None,Some(<http://www.w3.org/2001/XMLSchema#string>),List(),None,None,None)),None,None),None),C1->Pos(NodeConstraint(None,None,Some(<http://www.w3.org/2001/XMLSchema#date>),List(),None,None,None),None),C0->Pos(NodeConstraint(None,None,Some(<http://www.w3.org/2001/XMLSchema#string>),List(),None,None,None),None)Paths: Map(Direct(<http://schema.org/name>) -> Set(C0), Direct(<http://schema.org/birthDate>) -> Set(C1), Direct(<http://schema.org/gender>) -> Set(C2), Direct(<http://schema.org/knows>) -> Set(C3))---endTableErr: Interval checker failed with value <empty(2;1)> --

This is pretty incomprehensible to me and I was wondering if there's something I could to to make this output more readable. I'm calling the validator from Clojure using es.weso/shaclex_2.13 {:mvn/version "0.1.44" :extension "pom"} but the web app did not really give me any way to digest this info. I'm worried that at times when I don't really know what's the problem, the output will be hard to use as debugging aid.

Thank you!

@EmmanuelOga
Copy link
Author

Addon: same validation on ShEx2. Also not great since it doesn't tell me exactly what's wrong, only that some value exceeded some cardinality, but at least I can read it:

[{
  "node": "http://example.org/emily",
  "shape": "http://example.org/User",
  "status": "nonconformant",
  "elapsed": 3,
  "reason": "validating http://example.org/emily as http://example.org/User:\n    validating \"Emily\": exceeds cardinality"
}]

@labra
Copy link
Member

labra commented Apr 26, 2020

Thanks for pointing it and I must say that we completely agree with you.

We were aware of this issue and we wanted to tackle it but never had enough resources or time to do it.

Notice that the error messages are different depending on which validator engine you use (ShEx or SHACL). In the case of SHACL, the spec describes a validation report which can have more details about the validation process although in several cases the error messages are again not satisfactory.

In the case of ShEx, the spec describes the result of validation in terms of a shape map which mainly describes which nodes conform or not to which shapes, leaving to the implementations the possibility to improve that information.

We have created a specific issue on the ShEx-s implementation to tackle and track this.

@EmmanuelOga
Copy link
Author

EmmanuelOga commented Apr 27, 2020

Got it! Generating human readable error messages sounds like a complicated topic. Would it be a possible to at least identify which triple pattern of a shape triggered an error? (say, return that in the :appInfo key of the response shapemap, according to the book "a machine readable structure." I think shaclex always returns "shaclex" right now.)

I'm thinking the use case where I want to validate a form (the whole form representing, say, a User), and I want to identify which fields of the form have problems with a shape like

:User {
  schema:name xsd:string MinInclusive 1;
  schema:last-name xsd:string MinInclusive 1;
}

... I would like to know if either name or last-name failed to validate, or both, even if I don't have a precise explanation of why.

Perhaps doing that is equally difficult as fully generating human readable error messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants