Yes, and the underlying issue is that sh:prefixes will follow the owl:imports closure but while editing in EDG those owl:imports will be attached to the Home resource urn:x-evn-master:XY which is different from the external namespace resource. You could theoretically declare your prefixes at the external graph URI

ex:MyGraph
    a owl:Ontology ;
    owl:imports <http://datashapes.org/dash> ;
    sh:declare [ ... ]
.

and then do sh:prefixes ex:MyGraph in your SPARQL query.

In either case, this is a common pain point for SHACL users that unfortunately was required because RDF graphs do not have a concept of prefixes (which are an aspect of the serialization only), yet SHACL is serialization-agnostic.

Holger


On 2021-06-02 2:20 am, Irene Polikoff wrote:


On Jun 1, 2021, at 4:39 AM, Jan Voskuil <[email protected] <mailto:[email protected]>> 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 <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 <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:defaultNamespacehttp://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:importshttp://datashapes.org/dash <http://datashapes.org/dash>;
  owl:importshttp://datashapes.org/graphql <http://datashapes.org/graphql>;
  owl:importshttp://spinrdf.org/spl <http://spinrdf.org/spl>;
  owl:importshttp://topbraid.org/skos-xl.shapes <http://topbraid.org/skos-xl.shapes>;   owl:importshttp://topbraid.org/skos.shapes <http://topbraid.org/skos.shapes>;
  owl:importshttp://topbraid.org/tbgeo <http://topbraid.org/tbgeo>;
  owl:importshttp://topbraid.org/teamworkconstraints <http://topbraid.org/teamworkconstraints>;
  sh:declare [
      sh:namespacehttp://topquadrant.com/ns/examples/geography# <http://topquadrant.com/ns/examples/geography#>^^xsd:anyURI ;
      sh:prefix "g" ;
    ] ;
  sh:declare [
      sh:namespacehttp://www.w3.org/2004/02/skos/core# <http://www.w3.org/2004/02/skos/core#>^^xsd:anyURI ;
     sh:prefix "skos" ;
    ] ;
  sh:declare [
      sh:namespacehttp://www.wikidata.org/prop/direct/ <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
[email protected] <mailto:[email protected]>|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 [email protected] <mailto:[email protected]>. To view this discussion on the web visithttps://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 [email protected] <mailto:[email protected]>. 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/814d41ba-5caf-1a70-d360-4ef3b146749a%40topquadrant.com.

Reply via email to