shacl validation

57 views
Skip to first unread message

Bohms, H.M. (Michel)

unread,
Jun 14, 2022, 8:25:26 AM6/14/22
to topbrai...@googlegroups.com

I am doing something wrong?

 

Why no shac validation error (2x: two wheels and an inappropr. door) on data for:

 

(I would at least expect 1 error for the maxCount; maybe not for Door since independent needing second property shape maxcard=0 for door?))

 

@prefix rdfs: http://www.w3.org/2000/01/rdf-schema# .

@prefix sh: http://www.w3.org/ns/shacl# .

@prefix rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# .

@prefix ex: http://example.org/def/ .

@prefix owl: http://www.w3.org/2002/07/owl# .

 

ex: a owl:Ontology .

 

ex:hasPart

  a owl:ObjectProperty .

 

ex:RealObject

  a sh:NodeShape, owl:Class ;

  sh:property [

      sh:path ex:hasPart ;

                sh:class ex:RealObject

    ] ; .

 

ex:Car

  a sh:NodeShape, owl:Class ;

  rdfs:subClassOf ex:RealObject ;

  sh:property  [sh:path  ex:hasPart ;

                            sh:qualifiedMinCount 1 ;

                            sh:qualifiedMaxCount 1 ;

                            sh:qualifiedValueShape [ sh:class ex:Wheel ] ;

    ] ; .

 

ex:Wheel

  a sh:NodeShape, owl:Class .

 

ex:Door

  a sh:NodeShape, owl:Class .

 

ex:hasPart

  a owl:ObjectProperty .

 

ex:Car_1 rdf:type ex:Car ;

              ex:hasPart ex:Wheel_1 ;

              ex:hasPart ex:Wheel_2 ;

              ex:hasPart ex:Door_1 .

             

ex:Wheel_1 rdf:type ex:Wheel .

ex:Wheel_2 rdf:type ex:Wheel .

ex:Door_1 rdf:type ex:Door .

 

 

 

Michel Böhms
Data Scientist

Unit Buildings, Infrastructure & Maritime


Mobile +31 630381220
E-mail  
michel...@tno.nl

Location

 

This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. TNO accepts no liability for the content of this e-mail, for the manner in which you use it and for damage of any kind resulting from the risks inherent to the electronic transmission of messages.

 

 

 

Holger Knublauch

unread,
Jun 14, 2022, 6:07:29 PM6/14/22
to topbrai...@googlegroups.com

On 14 Jun 2022, at 10:25 pm, 'Bohms, H.M. (Michel)' via TopBraid Suite Users <topbrai...@googlegroups.com> wrote:

I am doing something wrong?

This depends on what you expect. I see 4 constraint violations, and they are because Wheel and Door are not declared as rdfs:subClassOf RealObject.

You state that you don’t get any violations, so which process/tool are you using?

Holger



This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. TNO accepts no liability for the content of this e-mail, for the manner in which you use it and for damage of any kind resulting from the risks inherent to the electronic transmission of messages.
 
<image002.png>
 
 

-- 
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/5642ddb307dc46b0ac4c08bc37d81a33%40tno.nl.

Bohms, H.M. (Michel)

unread,
Jun 15, 2022, 3:07:00 AM6/15/22
to topbrai...@googlegroups.com

Hi Holger

 

In this variant where Door and Wheel are not (yet) subclasses of RealObject I would expect indeed 4 errors (contrary to my expected 2 other error I expected but now understand):

  • a car having two wheels where one is allowed.
  • 3 parts that are not real objects

 

But there is nothing when I check in TBC (v 7.1.1):

 

 

Guess I miss a setting?

 

Thx Michel

 

 

 

Michel Böhms
Data Scientist

Unit Buildings, Infrastructure & Maritime


Mobile +31 630381220
E-mail  
michel...@tno.nl

Location

 

This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. TNO accepts no liability for the content of this e-mail, for the manner in which you use it and for damage of any kind resulting from the risks inherent to the electronic transmission of messages.

 

 

test.ttl

Holger Knublauch

unread,
Jun 15, 2022, 7:17:24 AM6/15/22
to topbrai...@googlegroups.com
On 15 Jun 2022, at 5:06 pm, 'Bohms, H.M. (Michel)' via TopBraid Suite Users <topbrai...@googlegroups.com> wrote:

Hi Holger
 
In this variant where Door and Wheel are not (yet) subclasses of RealObject I would expect indeed 4 errors (contrary to my expected 2 other error I expected but now understand):
  • a car having two wheels where one is allowed.
  • 3 parts that are not real objects
 
But there is nothing when I check in TBC (v 7.1.1):
 
<image003.png>
 
Guess I miss a setting?

You didn’t send the whole file, so I can only speculate that the file doesn’t owl:import the dash namespace?

Holger



 
Thx Michel
 
 
 
Michel Böhms
Data Scientist
Unit Buildings, Infrastructure & Maritime

Bohms, H.M. (Michel)

unread,
Jun 15, 2022, 7:31:01 AM6/15/22
to topbrai...@googlegroups.com

Actually it was the whole file 😊

 

Thought sh was only essential…

 

Added dash too

 

But no change in behaviour…

 

Adding the sh import however did ……

 

(also without dash that I deleted again)

 

THX!

 

 

 

 

Michel Böhms
Data Scientist

Unit Buildings, Infrastructure & Maritime


Mobile +31 630381220
E-mail  
michel...@tno.nl

Location

 

This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. TNO accepts no liability for the content of this e-mail, for the manner in which you use it and for damage of any kind resulting from the risks inherent to the electronic transmission of messages.

 

 

test.ttl

Holger Knublauch

unread,
Jun 15, 2022, 7:33:53 AM6/15/22
to topbrai...@googlegroups.com
As background, the TopBraid SHACL engine needs to know which constraint components exist, and those are then used to control the actual validation process. The constraint components are declared as instances of sh:ConstraintComponent in the sh namespace graph. The dash namespace owl:imports sh: so it should be enough to just import dash.

Holger


On 15 Jun 2022, at 9:30 pm, 'Bohms, H.M. (Michel)' via TopBraid Suite Users <topbrai...@googlegroups.com> wrote:

Actually it was the whole file 😊
 
Thought sh was only essential…
 
Added dash too
 
But no change in behaviour…
 
Adding the sh import however did ……
 
(also without dash that I deleted again)
 
THX!
 
 
 
 
Michel Böhms
Data Scientist
Unit Buildings, Infrastructure & Maritime

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

Bohms, H.M. (Michel)

unread,
Jun 15, 2022, 7:39:55 AM6/15/22
to topbrai...@googlegroups.com

 

Yes ok

For our standardization files we try to keep as generic/simple as possible

Hence sh over dash

 

Maybe you have counterarg. still to use dash?

 

 

Michel Böhms
Data Scientist

Unit Buildings, Infrastructure & Maritime


Mobile +31 630381220
E-mail  
michel...@tno.nl

Location

 

This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. TNO accepts no liability for the content of this e-mail, for the manner in which you use it and for damage of any kind resulting from the risks inherent to the electronic transmission of messages.

 

 

Bohms, H.M. (Michel)

unread,
Jun 15, 2022, 8:11:55 AM6/15/22
to topbrai...@googlegroups.com

My second variant makes Door and Window a subclass of an EXTERNAL nen2660:RealObject:

 

nen2660:RealObject

  a sh:NodeShape ;

  sh:property [

      sh:path nen2660:consistsOf ;

      sh:xone ( [ sh:class nen2660:Matter] [sh:class nen2660:MatterPortion ] ) ;

    ] ;

  sh:property [

      sh:path nen2660:hasPart ;

      sh:xone ( [ sh:class nen2660:RealObject] [ sh:class nen2660:Port ] ) ;

    ] ;

.

 

So the 3 errors disappeared as expected.

But I expected one to appear new on my extended data:

 

ex:Car_1 rdf:type ex:Car ;

              ex:hasPart ex:Wheel_1 ;

              ex:hasPart ex:Wheel_2 ;

              ex:hasPart ex:Door_1 ;

              ex:hasPart ex:NoRO_1 .

             

ex:Wheel_1 rdf:type ex:Wheel .

ex:Wheel_2 rdf:type ex:Wheel .

ex:Door_1 rdf:type ex:Door .

ex:NoRO_1 rdf:type ex:NoRO .

 

(NoRO not being a subclass of RealObject!).

 

 

 

Michel Böhms
Data Scientist

Unit Buildings, Infrastructure & Maritime


Mobile +31 630381220
E-mail  
michel...@tno.nl

Location

 

This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. TNO accepts no liability for the content of this e-mail, for the manner in which you use it and for damage of any kind resulting from the risks inherent to the electronic transmission of messages.

 

 

Holger Knublauch

unread,
Jun 15, 2022, 8:38:59 AM6/15/22
to topbrai...@googlegroups.com
To further such discussion topics, please attach the complete file and details about what you would expect. It takes too much guessing bandwidth otherwise.

Holger




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

Bohms, H.M. (Michel)

unread,
Jun 15, 2022, 10:44:14 AM6/15/22
to topbrai...@googlegroups.com

 

Sorry/thx

 

Test file: test2 importing nen2660-shacl importing nen2660-rdfs.

 

I expected a shacl error saying your car instance has a part (ex:NoRO_1 – No RealObject) that is not allowed since in imported shacl it says:

 

nen2660:RealObject

  a sh:NodeShape ;

  sh:property [

      sh:path nen2660:consistsOf ;

      sh:xone ( [ sh:class nen2660:Matter] [sh:class nen2660:MatterPortion ] ) ;

    ] ;

  sh:property [

      sh:path nen2660:hasPart ;

      sh:xone ( [ sh:class nen2660:RealObject] [ sh:class nen2660:Port ] ) ;

    ] ;

.

 

 

Note:

 

There IS another sh-validation error on qudt’ s quantity kind that I do not understand, but that is another issue.

 

 

Michel Böhms
Data Scientist

Unit Buildings, Infrastructure & Maritime


Mobile +31 630381220
E-mail  
michel...@tno.nl

Location

 

This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. TNO accepts no liability for the content of this e-mail, for the manner in which you use it and for damage of any kind resulting from the risks inherent to the electronic transmission of messages.

 

 

test2.ttl
nen2660-shacl.ttl
nen2660-rdfs.ttl

Holger Knublauch

unread,
Jun 15, 2022, 5:54:40 PM6/15/22
to topbrai...@googlegroups.com
Car is not a subclass of nen2660:RealObject but of ex:Car which is a subclass of ex:RealObject. So the constraint(s) don’t apply.

Also please make sure to use the sh: owl:import including the trailing #

We’ll look into why the quit violation appears.

HTH
Holger



On 16 Jun 2022, at 12:44 am, 'Bohms, H.M. (Michel)' via TopBraid Suite Users <topbrai...@googlegroups.com> wrote:

 
Sorry/thx
 
Test file: test2 importing nen2660-shacl importing nen2660-rdfs.
 
I expected a shacl error saying your car instance has a part (ex:NoRO_1 – No RealObject) that is not allowed since in imported shacl it says:
 
nen2660:RealObject
  a sh:NodeShape ;
  sh:property [
      sh:path nen2660:consistsOf ;
      sh:xone ( [ sh:class nen2660:Matter] [sh:class nen2660:MatterPortion ] ) ;
    ] ;
  sh:property [
      sh:path nen2660:hasPart ;
      sh:xone ( [ sh:class nen2660:RealObject] [ sh:class nen2660:Port ] ) ;
    ] ;
.
 
 
Note:
 
There IS another sh-validation error on qudt’ s quantity kind that I do not understand, but that is another issue.
 
 
Michel Böhms
Data Scientist
Unit Buildings, Infrastructure & Maritime

-- 
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/6a829f9d3ed5477285496265c13f3d17%40tno.nl.
<test2.ttl><nen2660-shacl.ttl><nen2660-rdfs.ttl>

Bohms, H.M. (Michel)

unread,
Jun 16, 2022, 3:53:11 AM6/16/22
to topbrai...@googlegroups.com

 

Thx, solved (my stupid mistake)

 

Wrt qudt validation error:

 

The relevant code is:

 

nen2660:hasQuantityKindShape

  a sh:NodeShape ;

  sh:class qudt:QuantityKind ; ERROR for this one

  sh:targetObjectsOf nen2660:hasQuantityKind ;

.

 

Maybe because it is not imported?

(only qudt is imported, not unit and quantitykind)

 

 

Ps updated test file added

 

 

Michel Böhms
Data Scientist

Unit Buildings, Infrastructure & Maritime


Mobile +31 630381220
E-mail  
michel...@tno.nl

Location

 

This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. TNO accepts no liability for the content of this e-mail, for the manner in which you use it and for damage of any kind resulting from the risks inherent to the electronic transmission of messages.

 

 

test2.ttl

Holger Knublauch

unread,
Jun 16, 2022, 7:04:09 PM6/16/22
to topbrai...@googlegroups.com

On 16 Jun 2022, at 5:53 pm, 'Bohms, H.M. (Michel)' via TopBraid Suite Users <topbrai...@googlegroups.com> wrote:

 
Thx, solved (my stupid mistake)
 
Wrt qudt validation error:
 
The relevant code is:
 
nen2660:hasQuantityKindShape
  a sh:NodeShape ;
  sh:class qudt:QuantityKind ; ERROR for this one
  sh:targetObjectsOf nen2660:hasQuantityKind ;
.
 
Maybe because it is not imported?

Yes, likely. Currently you only have


qudt:QuantityKind
  a nen2660:EnumerationType ;
  rdfs:seeAlso nen2660-term:QuantityKind ;
  skos:definition "Any observable property that can be measured and quantified numerically"@en ;
  skos:prefLabel "Quantity kind"@en ;
.

Holger


(only qudt is imported, not unit and quantitykind)
 
 
Ps updated test file added
 
 
Michel Böhms
Data Scientist
Unit Buildings, Infrastructure & Maritime
Reply all
Reply to author
Forward
0 new messages