sh:nodes and sh:minus

22 views
Skip to first unread message

Marie Valadez

unread,
Apr 26, 2024, 12:42:38 PMApr 26
to TopBraid Suite Users
Hello! 

I am trying to use infer values through sh:values using sh:nodes, sh:filterShape, sh:minus. 
However, it is not working as intended. Assuming I am writing something incorrectly. 

As a similar example to what I am doing. I want to infer values for a property through a skos:broader connection and then subtract any that the focusNode already has through the property and only infer values of a specific class. 

ex:Dog skos:broader ex:Mammal ; 
              ex:characteristics ex:Hair , ex:Four-legged, ex:Terrestrial, ex:Vertebrae.
ex:Mammal ex:characteristcs ex:Vertebrae, ex:MilkProducer, ex:Hair .

ex:Vertebrae rdf:type ex:SkeletalStructure .
ex:Four-legged rdf:type ex:Locomotion.
ex:MilkProducer rdf:type ex:Food .
ex:Terrestrial rdf:type ex:Habitat.

I want to create a set of inferred values from the parent which only include ex:SkeletalStructure and ex:Food. If the focusNode already has the value for the property then I do not want it to show up in the inherited values. 

 sh:values [
    sh:minus [sh:path ex:characteristics ]; #also tried as (sh:this ex:characteristics); also tried putting it with the sh:node itself.
      sh:filterShape [
          sh:or (
              [
                sh:class ex:Food ;
              ]
              [
                sh:class ex:SkeletalStructure;
              ]
            ) ;
        ] ;
      sh:nodes [
          sh:distinct [
        sh:path (
              skos:broader 
              ex:characteristics
            ) ;
          ];
    ] ;
  ]; 




Holger Knublauch

unread,
Apr 27, 2024, 5:08:38 AMApr 27
to 'Luis Enrique Ramos García' via TopBraid Suite Users
Hi Marie,

when you look at the diagram view of the sh:values rule you will note that something is missing:

PastedGraphic-2.png

The sh:minus is ignored because it "competes" with the sh:filterShape for the sh:nodes input. There is one level of nesting missing, as you have sh:filterShape and sh:minus on the same level.

I believe one solution might be:

sh:values [
sh:minus [
sh:path ex:characteristics ;
] ;
sh:nodes [
sh:distinct [
sh:filterShape [
sh:or (
[
sh:class ex:Food ;
]
[
sh:class ex:SkeletalStructure ;
]
) ;
] ;
sh:nodes [
sh:path (
skos:broader
ex:characteristics
) ;
] ;
] ;
] ;
] ;

which visualizes as


PastedGraphic-1.png

HTH
Holger


--
The topics of this mailing list include TopBraid EDG and related technologies such as SHACL.
To post to this group, send email to topbrai...@googlegroups.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.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/ce5778e0-06b7-44a0-905f-8f282056aa7dn%40googlegroups.com.

Marie Valadez

unread,
Apr 27, 2024, 9:57:23 AMApr 27
to topbrai...@googlegroups.com
Thank you so much Holger for the quick response! Appreciate the diagram as well to provide some context. I will give your suggestions a try!

You received this message because you are subscribed to a topic in the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/topbraid-users/nQORzQN4K0k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/ADA9B665-68D7-4564-8D8C-1861BF81ED45%40topquadrant.com.
Reply all
Reply to author
Forward
0 new messages