Does SHACL always treat rdf:type as transitive?

32 views
Skip to first unread message

Carl Burnett

unread,
Jul 7, 2022, 3:08:15 PM7/7/22
to Abridged recipients

I’ve written some sh:values rules for a property shape that filter out (using a sh:minus expression) results that have certain rdf:types. My rules work as desired except when a result has a type that is a subclass of a “banned” class and it is filtered out, which I don’t want.

 

Is there a way to specify that I only want my rule to filter out values that have the actual types I specify – not their subclasses?

 

Carl Burnett (he/him)

Senior Ontology Engineer  |  Healthwise

cbur...@healthwise.org  |  www.healthwise.org

208.489.8485

 

Holger Knublauch

unread,
Jul 7, 2022, 3:43:17 PM7/7/22
to topbrai...@googlegroups.com
sh:class will always include subclasses too. But to do direct matching you could probably do

[ sh:property [ sh:path rdf:type ; sh:hasValue CLASS ] ]

Or use SPARQL as in

[ sh:ask “ASK { $this a CLASS }” ]

(It’s hard to advise you without seeing the full sh:values rule that you have, so above are my best guesses).

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/MWHPR19MB1598DBA2CAC4BA294856273EB7839%40MWHPR19MB1598.namprd19.prod.outlook.com.

cbur...@healthwise.org

unread,
Jul 11, 2022, 1:01:24 PM7/11/22
to TopBraid Suite Users
Holger, my MINUS expression is a UNION of several things, but here is the relevant part:
               [
                sh:path [
                    sh:inversePath rdf:type ;
                  ] ;
                sh:nodes [
                    sh:path enterprise_schemas:excludedConceptTypes ;
                  ] ;
              ]

(The values of enterprise_schemas:excludedConceptTypes are calculated individually for each resource.)

Does this help?

Holger Knublauch

unread,
Jul 11, 2022, 2:44:21 PM7/11/22
to topbrai...@googlegroups.com

On 11 Jul 2022, at 1:01 pm, cbur...@healthwise.org <cbur...@healthwise.org> wrote:

Holger, my MINUS expression is a UNION of several things, but here is the relevant part:
               [
                sh:path [
                    sh:inversePath rdf:type ;
                  ] ;
                sh:nodes [
                    sh:path enterprise_schemas:excludedConceptTypes ;
                  ] ;
              ]

(The values of enterprise_schemas:excludedConceptTypes are calculated individually for each resource.)

Does this help?

Sorry, no, this doesn’t really clarify it for me. It doesn’t give me enough detail to have an executable toy example. Have you tried the hasValue solution or the ASK below? Where exactly are you stuck?

Holger



On Thursday, July 7, 2022 at 12:43:17 PM UTC-7 Holger Knublauch wrote:
sh:class will always include subclasses too. But to do direct matching you could probably do

[ sh:property [ sh:path rdf:type ; sh:hasValue CLASS ] ]

Or use SPARQL as in

[ sh:ask “ASK { $this a CLASS }” ]

(It’s hard to advise you without seeing the full sh:values rule that you have, so above are my best guesses).

Holger


On 7 Jul 2022, at 3:08 pm, Carl Burnett <cbur...@healthwise.org> wrote:

I’ve written some sh:values rules for a property shape that filter out (using a sh:minus expression) results that have certain rdf:types. My rules work as desired except when a result has a type that is a subclass of a “banned” class and it is filtered out, which I don’t want.
 
Is there a way to specify that I only want my rule to filter out values that have the actual types I specify – not their subclasses?
 
Carl Burnett (he/him)
Senior Ontology Engineer  |  Healthwise
 

-- 
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/MWHPR19MB1598DBA2CAC4BA294856273EB7839%40MWHPR19MB1598.namprd19.prod.outlook.com.


--
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.
Reply all
Reply to author
Forward
0 new messages