[SHACL API] ClassConstraintComponent issue

29 views
Skip to first unread message

Nensi Skenderi

unread,
Feb 20, 2023, 11:56:52 AM2/20/23
to TopBraid Suite Users
Hello,

So I have been using SHACL for a white now and I notice the following:

When I validate the below date and shape graph in https://shacl.org/playground/
I get only 2 validation reports which is perfectly fine. Screenshot 2023-02-20 at 5.53.26 PM.png


When I validate the same models in code I also get these ClassConstraintComponent violations. How to get rid of these without making changes in the models?

Screenshot 2023-02-20 at 5.55.33 PM.png


Thanks,
Nensi

Holger Knublauch

unread,
Feb 20, 2023, 12:04:28 PM2/20/23
to topbrai...@googlegroups.com
The two class-related violations originate from tosh.ttl, in particular the property shape tosh:Resource-type.

To get rid of these, either fix the model to include the correct class definitions or add the triple

tosh:Resource-type sh:deactivated true .

If you have the class definitions in some ontology or shapes file, you could owl:import that into the data graph and make it part of the data graph for validation purposes.

Holger




On 20 Feb 2023, at 4:56 pm, Nensi Skenderi <nensisk...@gmail.com> wrote:

Hello,

So I have been using SHACL for a white now and I notice the following:

When I validate the below date and shape graph in https://shacl.org/playground/
I get only 2 validation reports which is perfectly fine. <Screenshot 2023-02-20 at 5.53.26 PM.png>


When I validate the same models in code I also get these ClassConstraintComponent violations. How to get rid of these without making changes in the models?

<Screenshot 2023-02-20 at 5.55.33 PM.png>


Thanks,
Nensi


--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/d8d6a36b-5a95-4568-ab94-218fb58ed972n%40googlegroups.com.
<Screenshot 2023-02-20 at 5.55.33 PM.png><Screenshot 2023-02-20 at 5.53.26 PM.png>

Nensi Skenderi

unread,
Feb 20, 2023, 12:23:03 PM2/20/23
to TopBraid Suite Users
Hello Holger,

Many thanks for the fast reply.
I thought of this "either fix the model to include the correct class definitions" but in my case I can not do that.

So now I tried with the other suggestion you gave me. It worked.
I also added 

tosh:NodeShape-targetClass
sh:deactivated true .

in order to get rid of 

  sh:result    [ rdf:type                      sh:ValidationResult ;
                 sh:focusNode                  ex:PersonShape ;
                 sh:resultMessage              "Value must be an instance of rdfs:Class" ;
                 sh:resultPath                 sh:targetClass ;
                 sh:resultSeverity             sh:Violation ;
                 sh:sourceConstraintComponent  sh:ClassConstraintComponent ;
                 sh:sourceShape                tosh:NodeShape-targetClass ;
                 sh:value                      nensi:Person
               ] ;


Do you think it's a good idea to add 
tosh:NodeShape-targetClass
sh:deactivated true .


as well to get rid of these cases?

Thanks,
Nensi

Holger Knublauch

unread,
Feb 20, 2023, 12:25:45 PM2/20/23
to topbrai...@googlegroups.com

On 20 Feb 2023, at 5:23 pm, Nensi Skenderi <nensisk...@gmail.com> wrote:

Hello Holger,

Many thanks for the fast reply.
I thought of this "either fix the model to include the correct class definitions" but in my case I can not do that.

So now I tried with the other suggestion you gave me. It worked.
I also added 

tosh:NodeShape-targetClass
sh:deactivated true .

in order to get rid of 

  sh:result    [ rdf:type                      sh:ValidationResult ;
                 sh:focusNode                  ex:PersonShape ;
                 sh:resultMessage              "Value must be an instance of rdfs:Class" ;
                 sh:resultPath                 sh:targetClass ;
                 sh:resultSeverity             sh:Violation ;
                 sh:sourceConstraintComponent  sh:ClassConstraintComponent ;
                 sh:sourceShape                tosh:NodeShape-targetClass ;
                 sh:value                      nensi:Person
               ] ;


Do you think it's a good idea to add 
tosh:NodeShape-targetClass
sh:deactivated true .


That's up to you but yes why not.

Holger


Nensi Skenderi

unread,
Feb 20, 2023, 12:26:35 PM2/20/23
to TopBraid Suite Users
Great,


Thanks again,
Nensi

Reply all
Reply to author
Forward
0 new messages