# SHACL: icv remove not removing constraints?

**URL:** <https://community.stardog.com/t/shacl-icv-remove-not-removing-constraints/1788>\
**Category:** Support\
**Created:** [July 18, 2019, 2:46pm UTC](https://community.stardog.com/t/shacl-icv-remove-not-removing-constraints/1788 "2019-07-18T14:46:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![NovasTaylor](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/novastaylor/32/344_2.png) [@NovasTaylor](https://community.stardog.com/u/NovasTaylor)\
**Post date:** [July 18, 2019, 2:46pm UTC](https://community.stardog.com/t/shacl-icv-remove-not-removing-constraints/1788/1 "2019-07-18T14:46:48Z")

</div>

_**[UPDATE 2021-06-07: Issue remains in Stardog v. 7.4.0 for removing constraints that involve bnodes. any update on possible fix?]**_

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](https://w3id.org/phuse/study#rfendtc) ;  
sh:focusNode [https://w3id.org/phuse/cd16050#Subject\_TEST-1](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](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](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](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](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

---

<div class="post-metadata">

**Author:** ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)\
**Post date:** [July 19, 2019, 12:03pm UTC](https://community.stardog.com/t/shacl-icv-remove-not-removing-constraints/1788/2 "2019-07-19T12:03:54Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![NovasTaylor](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/novastaylor/32/344_2.png) [@NovasTaylor](https://community.stardog.com/u/NovasTaylor)\
**Post date:** [July 19, 2019, 12:27pm UTC](https://community.stardog.com/t/shacl-icv-remove-not-removing-constraints/1788/3 "2019-07-19T12:27:42Z")

</div>

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. 🙂

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](https://community.stardog.com/uploads/short-url/tIqy1DWa02DvfzVPLd0cfTsIs95.TTL) (3.6 KB) [SHACL\_AnimalSubject.TTL](https://community.stardog.com/uploads/short-url/bGIw3NX3Z3eR7pqPKQvZpB3kjFy.TTL) (1.1 KB)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [August 2, 2019, 12:27pm UTC](https://community.stardog.com/t/shacl-icv-remove-not-removing-constraints/1788/4 "2019-08-02T12:27:44Z")

</div>

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