Better formulated potential sh:declare issues

26 views
Skip to first unread message

Bohms, H.M. (Michel)

unread,
Sep 28, 2021, 11:12:48 AM9/28/21
to topbrai...@googlegroups.com, Miltos Gatzios

Together with our partner, BIM-Connected, Miltos Gatzios, we tried to better formulate the actual issue we see with sh:declare.

 

Issue 1 (not tbc issue, but general shacl issue)

 

Metalanguage (https://www.w3.org/ns/shacl.ttl):

 

sh:declare

        a rdf:Property ;

        rdfs:label "declare"@en ;

        rdfs:comment "Links a resource with its namespace prefix declarations."@en ;

        rdfs:domain owl:Ontology ;

        rdfs:range sh:PrefixDeclaration ;

        rdfs:isDefinedBy sh: .

 

Specification (Shapes Constraint Language (SHACL) (w3.org)):

 

“ The recommended subject for values of sh:declare is the IRI of the named graph containing the shapes that use the prefixes. These IRIs are often declared as an instance of owl:Ontology, but this is not required.”

 

 

So the spec is flexible but the metalanguage makes a choice that it actually IS the named graph using the prefixes AND that it IS at an instance of owl:Ontology.

 

Issue 2 (the actual tbc/edg issue)

 

The implementation in tbc/edg seems to use the more strict way as recommended (we assume since that sh name space is used).

But that one seems not to work while the flexible way DOES seem to work …

 

Greetings, Michel

 

Ps

Attached the file where the shacl-rule does work (but we think now all prefixes become of type owl:Ontology…)

In case the declare’s are all attached to sainput: (the graph/ontology-prefix), the rule does not result in results.

 

 

 

Dr. ir. H.M. (Michel) Bohms
Scientist Specialist
Structural Reliability

T +31 (0)88 866 31 07
M +31 (0)63 038 12 20
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.

 

sainput.ttl

David Price

unread,
Sep 28, 2021, 1:37:59 PM9/28/21
to topbrai...@googlegroups.com, Miltos Gatzios
Hi Michel,

I did not test anything but it looks to me like you’re having problems reading the W3C spec. I see this in your file:

rdf:
  sh:declare [
      sh:namespace "http://www.w3.org/1999/02/22-rdf-syntax-ns#"^^xsd:anyURI ;
      sh:prefix "rdf" ;
    ] ;
.

when the spec clearly says “The recommended subject for values of sh:declare is the IRI of the named graph containing the shapes that use the prefixes."

rdf: graph does not contain any shapes.

I expoect rdf: above should instead be 

  sh:declare [
      sh:namespace "http://www.w3.org/1999/02/22-rdf-syntax-ns#"^^xsd:anyURI ;
      sh:prefix "rdf" ;
    ] ;
.

Cheers,
David

P.S. If you have an issue with a W3C spec, please report it to the W3C rather than the TB user forum.


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. 
 

-- 
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/fd20239d403743a8a9aa80d4e96828ef%40tno.nl.
<sainput.ttl>


Bohms, H.M. (Michel)

unread,
Sep 28, 2021, 2:32:54 PM9/28/21
to topbrai...@googlegroups.com, Miltos Gatzios
Dear David
Please reread our issues.
This is exactly the point in our two subissues.

Issue1...recommended does not mean obliged. It also says optional owl:Ontology in the spec.
But indeed metalanguage is much stronger ... domain is owl:Ontology...

Issue 2
The file attached delivers rule results
If modelled the strict way...it does not


Thx Michel


Op 28 sep. 2021 19:38 schreef David Price <dpr...@topquadrant.com>:

Bohms, H.M. (Michel)

unread,
Sep 28, 2021, 2:54:23 PM9/28/21
to topbrai...@googlegroups.com, Miltos Gatzios
Wrt your ps

I think it is quite obvious that I mention this issue 1 here since it is so much related to the actual tbc issue being issue 2.

Op 28 sep. 2021 19:38 schreef David Price <dpr...@topquadrant.com>:

David Price

unread,
Sep 28, 2021, 3:47:11 PM9/28/21
to topbrai...@googlegroups.com, Miltos Gatzios
Hi Michel,

I did the following from your example but following the W3C spec and it works fine in Composer:

  sh:declare [
      sh:namespace "http://www.w3.org/1999/02/22-rdf-syntax-ns#"^^xsd:anyURI ;
      sh:prefix "rdf" ;
    ] ;
  sh:declare [
      sh:namespace "https://w3id.org/sa/def#"^^xsd:anyURI ;
      sh:prefix "sa" ;
    ] ;
  sh:declare [
      sh:namespace "https://w3id.org/sainput/def#"^^xsd:anyURI ;
      sh:prefix "sainput" ;
    ] ;
.
sainput:MonsterLaag
  a owl:Class ;
  a sh:NodeShape ;
  rdfs:label "MonsterLaag" ;
  sh:rule [
      a sh:SPARQLRule ;
      sh:construct """
       CONSTRUCT {
         ?project rdf:type sa:Project .
       }
       WHERE {
         ?this sainput:projectOmschrijving ?omschrijving .
         BIND (IRI (CONCAT (\"https://w3id.org/sa/def#\", encode_for_uri (?omschrijving))) AS ?project) .
       }
       """ ;
      sh:prefixes <https://w3id.org/sainput/owl/def> ;
    ] ;
.


Please see SHACL spec 

5.1 An Example SPARQL-based Constraint - see https://www.w3.org/TR/shacl/#sparql-constraints

and


Cheers,
David


Bohms, H.M. (Michel)

unread,
Sep 28, 2021, 4:52:20 PM9/28/21
to topbrai...@googlegroups.com, Miltos Gatzios
Hi David
This did not work for me earlier starting the whole issue but i will retry again tomorrow.

The spec I know and copied earlier.
The issue is that in that paragraph ...the link you copy below...it says "recommended" and "optional" where looking at the rdfs def of sh:declare it is much stronger since the domain there specifies owl:Ontology.

So to be consistent the spec should say something like..."the declare shall always be for an ontology graph".....

Anyway that is a shacl issue indeed...

I will focus first on the second issue....let you know outcome...

Thx michel


Op 28 sep. 2021 21:47 schreef David Price <dpr...@topquadrant.com>:

Bohms, H.M. (Michel)

unread,
Sep 28, 2021, 6:07:10 PM9/28/21
to topbrai...@googlegroups.com, Miltos Gatzios
Hi David

Miltos cracked my problem finally based on your example.

1. The shacl issue1 wrt domain is still there but lets forget...lets assume domain should be always ontology.

2. Issue2 was never in the sh:declare

3. It was in the prefixes that should have target owl ontology hence base uri not name space uri

4. In many examples in spec etc no problem where often base uri == ns uri
5. But not in our case!
6. I used ns uri but should be different base uri including owl fragment etc. So i should write full uri like you did...not the prefix only valid for ns uri here.

Sighhhhh...thx for your patience as usual, greetings and thx michel/miltos

Op 28 sep. 2021 21:47 schreef David Price <dpr...@topquadrant.com>:
Reply all
Reply to author
Forward
0 new messages