Search code examples
javavalidationrdfsemantic-webshex

ShEx Validation - reason and appInfo are null in Result Shape Map


I am learning ShEx and using 'shexjava API' done by http://shexjava.lille.inria.fr/ for my project. I have schema, data graph and fixed shape map. When I validate using refine and recursive validation, I am getting ResultShapeMap but the reason and appInfo are null for NONCONFORMANT status. I do not understand why these two fields are null.

I have schema, dataGraph, shapeMap. This is code for validation.

ValidationAlgorithm vl = new RefineValidation(schema, dataGraph); 
ResultShapeMap result = vl.validate(shapeMap);

Shape is,

{
  "@context": "http://www.w3.org/ns/shex.jsonld",
  "type": "Schema",
  "shapes": [
        {
          "id": "http://example.com/ns#HouseShape",
          "type": "Shape",      
           "expression": {
                "type": "EachOf",
                "expressions": [
                  { "type":      "TripleConstraint",
                    "predicate": "http://example.com/ns#number",
                    "valueExpr": { "type": "NodeConstraint", 
                                   "datatype": "http://www.w3.org/2001/XMLSchema#String"
                    }
                  },
                  { "type":      "TripleConstraint",
                    "predicate": "http://example.com/ns#size",                
                    "valueExpr": { "type": "NodeConstraint", 
                                   "datatype": "http://www.w3.org/2001/XMLSchema#decimal"
                    }
                  }
                ]
              }      
        }
  ]
}

Data is,

ex:House1 a ex:House ; 
          ex:number "11A" ; 
          ex:size 23 .

My Result is,

ResultShapeMap [ 
   associations= [
      ShapeAssociation [
        nodeSelector=<example.com/ns#House>, 
        shapeSelector=<example.com/ns#HouseShape>, 
        status=NONCONFORMANT, 
        reason=null, 
        appInfo=null 
      ] 
   ] 
] 

I want to output the reason for not conforming. But it gives me null for that.

Could some one please help me.


Solution

  • The shexjava implementation currently does not support indicating a reason for failure. This is because when a node does not satisfy a shape there may be several reasons.

    If you want to learn ShEx, I would advise you to use ShapeDesigner

    https://gitlab.inria.fr/jdusart/shexjapp/

    which provides a graphical interface in which you can explore validation results.

    In this particular case, it indicates that the validation fails because 23 is not a decimal (it's actually an integer) Screenshot of validation exploration result in ShapeDesigner

    I do not know whether this is a bug, i.e. whether integrers should be considered to be also decimals in RDF.