SHACL validation on a Virtual graph

We are trying to validate a VKG(sms file) against SHACL shapes (shapes are generated by SHACLPLAY). Following is the syntax we followed in stardog studio.

VALIDATE GRAPH VIRTUAL://mssql_db128667118678699599_vkg

USING SHAPES

{
// shape graph
}.

We gave a wrong shape graph which does not support the vkg which we are trying to validate. But we always get the output as

{
_:bnode_8fb7fdcf_07d1_40e2_ba5a_4e857e7d7ed6_13140 a http://www.w3.org/ns/shacl#ValidationReport ;
http://www.w3.org/ns/shacl#conforms true .
}

We expected a validation report with the violations reported.Also we would like to know if there is an option to add SHACL contraints to a VKG.

Option2: (To add SHACL shapes and validate)
We also tried to add SHACL shapes by

  • selecting a new tab (in worksheet option and switch to SHACL view)
  • Add SHACL shape graph
  • Select Database and VKG
  • Get validation report
    The above option also returns " sh:conforms true ."

Could you please help.

Hi Remya,

There's possibly two problems.

The first is that the graph name prefix for virtual graphs is virtual:// (lower case). Note to anyone reading this in HTML mode - the entire graph name is enclosed in angle brackets, which are removed in that mode. I can see when viewing in RAW mode that they are present in your query so no problem there.

The second potential problem is that running SHACL validation against a virtual graph requires an additional simple.target option which you can set in the query using a hint:

#pragma simple.target on
VALIDATE GRAPH <virtual://mssql_db128667118678699599_vkg> USING SHAPES {
  // shape graph
}

-Paul

Hello Paul,

Thank you for the reply. I tried the below option. But still it returns
{
_:bnode_8fb7fdcf_07d1_40e2_ba5a_4e857e7d7ed6_16196 a http://www.w3.org/ns/shacl#ValidationReport ;
http://www.w3.org/ns/shacl#conforms true .
}

#pragma simple.target on
VALIDATE GRAPH virtual://online_db128667118678699599_vkg USING SHAPES
{
@prefix : http://erd_sqlite/bike_1# .
@prefix rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# .
@prefix owl: http://www.w3.org/2002/07/owl# .
@prefix sh: http://www.w3.org/ns/shacl# .
@prefix xsd: http://www.w3.org/2001/XMLSchema# .
@prefix rdfs: http://www.w3.org/2000/01/rdf-schema# .

:station-name_dp a sh:PropertyShape ;
sh:datatype xsd:string ;
sh:path :name_dp .

:station-dock_count_dp
a sh:PropertyShape ;
sh:datatype xsd:integer ;
sh:path :dock_count_dp .

:station a sh:NodeShape , rdfs:Class ;
sh:property :station-name_dp , :station-dock_count_dp .
}

As mentioned in the first post, we also tried the below approach to run SHACL validation against a VKG as below: Is this a correct option to run SHACL validation?

  • selecting a new tab (in worksheet option and switch to SHACL view)
  • copy shape graph
  • Select Database and VKG
  • Get validation report

This too returns sh:conforms = true

shapes are generated using SHACLPLAY

Thanks, Remya