On 2021-03-24 8:48 am, Steve Ray wrote:

Also, the ambiguity in the example is that ex: represents both a prefix found in the SPARQL query and also represents the URI for the ontology in which the prefixes are defined. I had interpreted the example at https://www.w3.org/TR/shacl/#sparql-constraints-example <https://www.w3.org/TR/shacl/#sparql-constraints-example> to mean "Identify all the prefixes you need in the query here" rather than "go to this URI to find all the prefix definitions".

Also, by the way, I have never succeeded in using the prefix as in your example at https://www.w3.org/TR/shacl/#sparql-constraints-example <https://www.w3.org/TR/shacl/#sparql-constraints-example>. In your example you say
        sh:prefixes ex: ;
                sh:select """
I have only gotten it to work when I expand ex: to the full URI. I wondered whether it was because the ex: turns into http://example.com/ns# <http://example.com/ns#> and when I spell it out I don't include the #, rather I write <http://example.com/ns <http://example.com/ns>>.

Yes this is easy to get wrong. URLs ending with # are often used without the # for the base URI/owl:Ontology. This problem doesn't exist for namespaces ending with /

So regardless of the namespace, you typically want to reference the *base URI* (aka named graph) which is where the owl:Ontology is. In the SHACL spec's example that base URI and namespace are identical and both end with the #. However, if you had

<http://example.com/ns>
    a owl:Ontology ;
    sh:declare ...

then you would use sh:prefixes <http://example.com/ns> without the hash. For the examples and the SHACL namespace itself we chose to use a # URL both for the namespace and the graph URI.

(These are very recurring questions not only from you, which indicates that there is a deeper design problem with this aspect of the RDF world).

Holger



Steve




On Tue, Mar 23, 2021 at 3:32 PM Holger Knublauch <[email protected] <mailto:[email protected]>> wrote:


    On 2021-03-24 2:36 am, Steve Ray wrote:
    I think the light bulb just went on.

    Are you saying that the natural language interpretation of the
    sh:prefixes triple *_inside_* a SPARQLRule is:

    "Go to the following graph URI to get the definitions for the
    prefixes you will need in the SPARQL query"...

    ...and in the ontology declaration, you use the sh:declare to do
    those definitions.  (without wrapping those sh:declare statements
    inside a sh:prefixes clause)?

    Yes exactly. The idea is that each graph declares its "main"
    prefix and then includes the other prefixes that it needs via
    owl:imports. Since the owl:imports are found at the graph URI
    resource, this was a natural place to attach this info to, without
    too much redundancy. Anyone who owl:imports your graph can then
    use its own owl:Ontology and will get the other prefix
    declarations automatically.

    A problem is that this one example in the SHACL spec

    https://www.w3.org/TR/shacl/#sparql-constraints-example
    <https://www.w3.org/TR/shacl/#sparql-constraints-example>

    doesn't include the triples behind ex: and most readers will not
    scroll down to

    https://www.w3.org/TR/shacl/#sparql-prefixes
    <https://www.w3.org/TR/shacl/#sparql-prefixes>

    for the full picture.

    Holger



    (I will test this while waiting for the Australian day to begin. :)


    Steve




    On Mon, Mar 22, 2021 at 4:49 PM Holger Knublauch
    <[email protected] <mailto:[email protected]>> wrote:

        In your first example, add

          sh:rule [
              a sh:SPARQLRule ;
              sh:prefixes
        <http://data.ashrae.org/standard223/1.0/inference/owl-subset>
        <http://data.ashrae.org/standard223/1.0/inference/owl-subset> ;

        because

        <http://data.ashrae.org/standard223/1.0/inference/owl-subset>
        <http://data.ashrae.org/standard223/1.0/inference/owl-subset>
            sh:declare [
              sh:namespace "http://www.w3.org/2002/07/owl#";
        <http://www.w3.org/2002/07/owl#>^^xsd:anyURI ;
              sh:prefix "owl" ;
            ] .

        is already a correct prefix declaration.

        If you attempt something like in your second example:

              sh:prefixes <http://www.w3.org/2002/07/owl>
        <http://www.w3.org/2002/07/owl> ;

        then the assumption is that the following triples are present

        <http://www.w3.org/2002/07/owl> <http://www.w3.org/2002/07/owl>
            sh:declare [
              sh:namespace "http://www.w3.org/2002/07/owl#";
        <http://www.w3.org/2002/07/owl#>^^xsd:anyURI ;
              sh:prefix "owl" ;
            ] .

        which they are not.

        There is clear evidence that too many people struggle with
        this aspect of the SHACL spec, and that as an editor I should
        have done a better job there. If I could simply re-upload the
        SHACL spec this would be the first thing to fix. However, the
        formal W3C process doesn't allow this easily.

        I have to admit I never liked to even have the need to
        declare those namespaces as triples - this is a mixed
        blessing because nobody seems to understand the syntax yet
        namespace prefixes are a serialization concept only, not a
        graph concept. At some stage I may just give up on this and
        change our SHACL engine to simply add the declared prefixes
        from the files, like SPIN did for pragmatic reasons, ignoring
        the spec.

        BTW both examples have a mismatch between the baseURI and the
        owl:Ontology. I suggest to keep them aligned.

        HTH
        Holger


        On 2021-03-23 6:40 am, Steve Ray wrote:

        I have been working around this problem by avoiding any
        prefixes when defining a shape with SPARQL, but this still
        bugs me. Attached are two tiny files, epp1.shapes.ttl and
        epp2.shapes.ttl.

        I'm running the SHACL reasoner.
        epp1 works - it does not use any prefixes inside the shape.
        epp2 is identical to epp1, except it declares the owl:
        prefix in the shape.

        TBC complains that it cannot resolve owl:SymmetricProperty.

        I have tried following the documentation for this, but
        clearly I'm getting something wrong. What am I missing?

        Steve


-- 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/CAGUep85Rf1yk3YVsLV3ihJjso7w5uF%2BBGqFOSpPWybBCuGw6nQ%40mail.gmail.com
        
<https://groups.google.com/d/msgid/topbraid-users/CAGUep85Rf1yk3YVsLV3ihJjso7w5uF%2BBGqFOSpPWybBCuGw6nQ%40mail.gmail.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/e0633424-2ad7-12b8-e035-fd553f0e92ed%40topquadrant.com
        
<https://groups.google.com/d/msgid/topbraid-users/e0633424-2ad7-12b8-e035-fd553f0e92ed%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]
    <mailto:[email protected]>.
    To view this discussion on the web visit
    
https://groups.google.com/d/msgid/topbraid-users/CAGUep85BWQbeqdh35OGKrqcmG13TbTo%3DD7Or-QsVOQoFq61PUA%40mail.gmail.com
    
<https://groups.google.com/d/msgid/topbraid-users/CAGUep85BWQbeqdh35OGKrqcmG13TbTo%3DD7Or-QsVOQoFq61PUA%40mail.gmail.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/8e829632-e471-b342-a957-b9b49c5c0ca8%40topquadrant.com
    
<https://groups.google.com/d/msgid/topbraid-users/8e829632-e471-b342-a957-b9b49c5c0ca8%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] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/CAGUep84OsS4puuF3e9UM2k8sR5Eg9b_MvVGb1Eh9Ks%2Bj5-rbQQ%40mail.gmail.com <https://groups.google.com/d/msgid/topbraid-users/CAGUep84OsS4puuF3e9UM2k8sR5Eg9b_MvVGb1Eh9Ks%2Bj5-rbQQ%40mail.gmail.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/360a510f-3bc0-0bf4-ef2c-481b6b6e55e8%40topquadrant.com.

Reply via email to