'Remove Constraint' remove all constraints?

Will Stardog Studio 'Remove Constraint' remove all constraints? I tried change shacl and failed. It seems to me 'Remove Constraint' does not remove all constraints, or did I make any mistake?

I am using Stardog Studio PC version, server side is stardog 7.6.2.
I download stardog-tutorials from github. Modify the sample shacl file: shacl/music_shacl.ttl:

  • Add a 'sh:maxLength 100 ' constraint to NameShape. add constraint and load valid.ttl, which is success. Then cleanup: remove data and constraint;
  • Then I change Nameshape shacl maxLength to 'sh:maxLength 5 ;'; add constraint and load valid.ttl again, failed, which is expected because maxLength is only 5; Then cleanup: remove constraint;
  • Then I change Nameshape shacl maxLength back to 'sh:maxLength 100 ;' add constraint and load valid.ttl again, FAIL, why??? We just prove 100 is a valid constraint in prior step.
    Did I missing anything???

I also did other tests in different order, it seems to me that as long as shacl fail, it will always fail. 'Remove Constraint' can not remove the failed shacl.

Here is the complete nameshape that I changed, the only thing change is add a maxLength;
:NameShape a sh:Shape ;
sh:property [
sh:path :name ;
sh:minCount 1 ;
sh:maxLength 100 ; ----> change back and forth to 5, 100;
sh:datatype xsd:string
] .

Here are the detail steps:

  1. Goto GitHub - stardog-union/stardog-tutorials: Data files for the Stardog tutorials clone

  2. create a new database, turn database offline then change properties transaction->Serizable; ICV guard mode enabled; turn on database;

  3. 'Add Data' Band schema from music/music_schema.ttl:
    :Band a rdfs:Class ;
    rdfs:label "Band" ;
    rdfs:comment "A music group; that is, is a group of people creating and performing music together." ;
    rdfs:subClassOf :Artist .

  4. Add 'sh:maxLength 100 ;' to NameShape to shacl/music_shacl.ttl; then add constraints;

  5. load data shacl/valid.ttl; success, which is expected;

  6. Remove data valid.ttl, remove constraint music_schema.ttl;

  7. Modify maxLength to 'sh:maxLength 5 ;' to NameShape to shacl/music_shacl.ttl; then add constraints;

  8. load data shacl/valid.ttl; fail, which is also expected;

  9. Remove constraints

  10. Modify back 'sh:maxLength 100 ;' to NameShape to shacl/music_shacl.ttl; then add constraints;

  11. load data shacl/valid.ttl; fail. WHY???? We just prove maxLength 100 is perfect fine in prior step.


Anyone using Shacl in StarDog? If you want to make Shacl change, what will you do?

  • Drop database, then recreate? This will work, but how can this be in Production?

  • Import Shacl constraint initially. Then remove and re-import shacl constraints for changes. If you pick this approach, do you have any trouble? I tried this approach and found Shacl constraint can not be completely removed.

  • Add Shacl as data initially. Then remove and re-add shacl as data for changes. I tried this approach also, and found Shacl data can not be completely removed.

It seems this issue exist for a while, any solution?

The easiest solution is to add SHACL constraints into a named graph (just as normal RDF data, e.g. with the data add command). Then clear that graph, edit your constraints, and re-add to the same graph.


1 Like

Named graph will work. While I still can not completely remove the Shacl through remove data, but since we can edit constraint directly through Stardog Studio, so I can remove all constraint this way. Thanks.

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