Thanks Irene, very useful, -j From: topbraid-users@googlegroups.com <topbraid-users@googlegroups.com> On Behalf Of Irene Polikoff Sent: 01 June 2021 18:21 To: topbraid-users@googlegroups.com Subject: Re: [topbraid-users] Proper use of sh:prefixes
On Jun 1, 2021, at 4:39 AM, Jan Voskuil <jan.vosk...@taxonic.com<mailto:jan.vosk...@taxonic.com>> wrote: Hi, While trying to familiarize myself with sh:values in EDG, I fail to get the results I think I expect using sh:prefixes. I’ve read the spec and Holger’s mail dd March 22 2021 on this topic in this forum. In TopBraid Examples Geo Ontology, I added a values property shape to g:GeoConcept that counts the number of narrowers, see [1]. It works as expected. But I had to use sh:prefixes as in [2], with the urn-URI. When using the “external graph URI” as the graphURI as in [3], the prefix declaration is not found, even though I did set this parameter on the settings tab, as seen under [4]. The external graphURI is to be used as value of owl:imports*, so I would expect [3] to work, or is this by design? -j Right, the external graph URI only works for import/export and re-directs of owl:imports, not in SPARQL. You do need to refer to the actual URI that has prefix declarations. Btw, Your declarations in (4) seem to be missing quotes around the namespaces. They should be sh:declare [ sh:namespace "http://topquadrant.com/ns/examples/geography#"^^xsd:anyURI ; sh:prefix "g" ; ] ; You probably already know this, but just in case - if you decide to declare a prefix in the query, use: sh:values [ sh:prefixes [ sh:declare [ sh:namespace "http://www.w3.org/2004/02/skos/core#"^^xsd:anyURI ; sh:prefix "skos" ; ] ; ] ; sh:select """ SELECT COUNT(?n) WHERE { ?n skos:broader ?this . } """ ; ] ; Also, there is no need to use SPARQL for this particular example. You could do the following: skos:Concept-countOfChildren a sh:PropertyShape ; sh:path g:countOfChildren ; sh:datatype xsd:integer ; sh:name "count of children" ; sh:values [ sh:count [ sh:path [ sh:inversePath skos:broader ; ] ; ] ; ] ; . [1] <image002.png> [2] g:GeoConcept-numberOfNarrowers a sh:PropertyShape ; sh:path g:numberOfNarrowers ; sh:datatype xsd:integer ; sh:maxCount 1 ; sh:name "number of narrowers" ; sh:values [ sh:prefixes <urn:x-evn-master:geography_ontology> ; sh:select """ SELECT COUNT(?n) WHERE { ?n skos:broader ?this . } """ ; ] ; . [3] sh:prefixes <http://topquadrant.com/ns/examples/geography#<http://topquadrant.com/ns/examples/geography>> ; or sh:prefixes g: ; [4] <urn:x-evn-master:geography_ontology> a owl:Ontology ; metadata:status metadata:UnderDevelopmentStatus ; swa:defaultNamespace http://topquadrant.com/ns/examples/geography#<http://topquadrant.com/ns/examples/geography> ; teamwork:externalGraphURI g: ; rdfs:comment "Schema definition for Geography Taxonomy." ; rdfs:label "TopBraid Examples Geo Ontology" ; owl:imports http://datashapes.org/dash ; owl:imports http://datashapes.org/graphql ; owl:imports http://spinrdf.org/spl ; owl:imports http://topbraid.org/skos-xl.shapes ; owl:imports http://topbraid.org/skos.shapes ; owl:imports http://topbraid.org/tbgeo ; owl:imports http://topbraid.org/teamworkconstraints ; sh:declare [ sh:namespace http://topquadrant.com/ns/examples/geography#<http://topquadrant.com/ns/examples/geography>^^xsd:anyURI ; sh:prefix "g" ; ] ; sh:declare [ sh:namespace http://www.w3.org/2004/02/skos/core#<http://www.w3.org/2004/02/skos/core>^^xsd:anyURI ; sh:prefix "skos" ; ] ; sh:declare [ sh:namespace http://www.wikidata.org/prop/direct/^^xsd:anyURI ; sh:prefix "wdt" ; ] ; . Jan Voskuil | CEO Taxonic Veldzigt 2, 3454 PW, De Meern, The Netherlands T +31 (0)88 829 66 00 | M:+31 (0)6 14488335 jan.vosk...@taxonic.com<mailto:jan.vosk...@taxonic.com> | www.taxonic.com<http://www.taxonic.com/> Registered office in Den Haag, The Netherlands Registration Number Chamber of Commerce: 54529190 -- 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-users+unsubscr...@googlegroups.com<mailto:topbraid-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/AM0PR03MB37457F535B94C01BE60F12B9E93E9%40AM0PR03MB3745.eurprd03.prod.outlook.com<https://groups.google.com/d/msgid/topbraid-users/AM0PR03MB37457F535B94C01BE60F12B9E93E9%40AM0PR03MB3745.eurprd03.prod.outlook.com?utm_medium=email&utm_source=footer>. -- 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-users+unsubscr...@googlegroups.com<mailto:topbraid-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/2FBA4796-A717-49CA-B3BB-4ADA23E4DE54%40topquadrant.com<https://groups.google.com/d/msgid/topbraid-users/2FBA4796-A717-49CA-B3BB-4ADA23E4DE54%40topquadrant.com?utm_medium=email&utm_source=footer>. -- 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-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/AM0PR03MB3745F4282A141F7C6C9B3FD5E93B9%40AM0PR03MB3745.eurprd03.prod.outlook.com.