SHACL: icv remove not removing constraints?

Hi folks,

I may be doing something wrong here, but it appears to me that the icv remove command is not fully removing constraints from the database. Am I missing an option in the remove command? Here are my steps and results. I'm running this from the command line to take Studio out of the equation (related post from yesterday).

  1. Create new database SHACLTest.

  2. Load data.

  3. Add constraint file:
    stardog-admin icv add SHACLTest SHACL_SD1002-DEV.TTL
    (Success)

  4. Run report:
    stardog icv report SHACLTest

One error is correctly returned;
[
a sh:ValidationReport ;
sh:result [
a sh:ValidationResult ;
sh:resultMessage "Data error: Date value not in date or dateTime format." ;
sh:resultPath https://w3id.org/phuse/study#rfendtc ;
sh:focusNode https://w3id.org/phuse/cd16050#Subject_TEST-1 ;
sh:sourceShape :rfendtcDateFormatShape ;
sh:sourceConstraintComponent sh:OrConstraintComponent ;
sh:resultSeverity sh:Violation ;
sh:value "2019-01-30"
] ;
sh:conforms false
] .

  1. Remove constraint.
    stardog-admin icv remove SHACLTest SHACL_SD1002-DEV.TTL
    (Success)

  2. Run the report:
    stardog icv report SHACLTest

Success: Conforms true because no constraints in place.
[
a sh:ValidationReport ;
sh:conforms true
] .

  1. Add same constraint file again.
    stardog-admin icv add SHACLTest SHACL_SD1002-DEV.TTL
    (Success)

  2. Run report:
    stardog icv report SHACLTest

Now the same error is reported twice:
[
a sh:ValidationReport ;
sh:result [
a sh:ValidationResult ;
sh:sourceConstraintComponent sh:OrConstraintComponent ;
sh:focusNode https://w3id.org/phuse/cd16050#Subject_TEST-1 ;
sh:value "2019-01-30" ;
sh:resultSeverity sh:Violation ;
sh:sourceShape :rfendtcDateFormatShape ;
sh:resultPath https://w3id.org/phuse/study#rfendtc ;
sh:resultMessage "Data error: Date value not in date or dateTime format."
] , [
a sh:ValidationResult ;
sh:focusNode https://w3id.org/phuse/cd16050#Subject_TEST-1 ;
sh:resultSeverity sh:Violation ;
sh:value "2019-01-30" ;
sh:sourceShape :rfendtcDateFormatShape ;
sh:resultPath https://w3id.org/phuse/study#rfendtc ;
sh:resultMessage "Data error: Date value not in date or dateTime format." ;
sh:sourceConstraintComponent sh:OrConstraintComponent
] ;
sh:conforms false
] .

If I remove and add the same constraint file again and run the report, the same error is now reported 3 times, etc.

Stardog version 6.1

Cheers,

Tim

Hi Tim,

This seems related to some weirdness we've encountered when removing BNodes via data remove, in that when parsed they're given different BNode IDs and therefore don't match what's already in the data. If you share your SHACL_SD1002-DEV.TTL we may be able to help you tweak it to work while we look into it.

Hi Stephen,

Thanks for the follow up. I've attached two files. The data (CJ16050-DM-SD1002-TestData.TTL) is in the public domain, so no worries there.

The SHACL file name changed since my original post, but I confirmed the same behavior. Comments on how to improve my SHACL are always welcome. :slight_smile:

Providing an interim kludge is not really necessary because this is just an example, and I can dump/recreate my small example database easily. Fixing the root cause would be great, because we are creating some example SHACL for new users, and I know this issue will trip them up.

Cheers!

Tim

CJ16050-DM-SD1002-TestData.TTL (3.6 KB) SHACL_AnimalSubject.TTL (1.1 KB)

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.