On 16/09/2020 05:37, Carl Burnett wrote:

I guess this makes sense. I added a *sh:minCount *of 1.

Now I get no violation when *concept_schema:preferred_specialty* has a value. But I still get a violation when only *concept_schema:preferred_specialty_inferred *has a value. I imagine this is because it can only have inferred values and not explicit ones, or perhaps because the *sh:path *of the property shape is a magic property. This is what the property shape looks like:

concept_schema:HwcvConcept-has_inferred_specialty

  a sh:PropertyShape ;

  sh:path <http://metadata.healthwise.org/app/magic-props#has_inferred_specialty> ;

  rdfs:label "managing specialties (inferred)" ;

  sh:class concept_schema:SpecialtyConcept ;

  sh:group concept_schema:Ontological_Relationships ;

  sh:name "managing specialties (inferred)" ;

  sh:nodeKind sh:IRI ;

  sh:order 8.1 ;

  sh:values [

<http://metadata.healthwise.org/app/magic-props#has_inferred_specialty> (

          sh:this

        ) ;

    ] ;

.

Is there anything I can do to tell the SHACL engine that inferred values for has_inferred_specialty should meet my *sh:xone *constraint?

Up to 6.4, SHACL validation does not "see" the inferred values unless you have asserted them beforehand.

From 7.0 onwards, you can activate these inferences to be computed beforehand, by adding a triple

    ?ontology sh:entailment sh:Rules .

The latter should already work with the latest SHACL API snapshot.


As an aside: the phrasing of the constraint violation message for sh:xone could be a lot better. My taxonomy’s users don’t know or care what a “sh:xone enumeration” means. What would be helpful to them is a message like this: “Either [concept 1] or [concept 2] should have a value, but not both.”

I agree the current message template

"Value has " + count + " shapes out of " + shapes.size() + " in the sh:xone enumeration"

is a bit geeky. It would be doable to change it to "Value must conform to exactly one of the following shapes, but conforms to N: ..., ..., ...]"

It would be much harder to construct a message as you suggest because that would require deeper understanding of the mentioned shapes.

Holger


*From:* topbraid-users@googlegroups.com <topbraid-users@googlegroups.com> *On Behalf Of *Irene Polikoff
*Sent:* Tuesday, September 15, 2020 11:35 AM
*To:* topbraid-users@googlegroups.com
*Subject:* Re: [topbraid-users] SHACL help

*** External email: use caution ***

When minCount is not stated, it means minCount = 0.

Thus,

sh:property [

            sh:path concept_schema:preferred_specialty ;

          ] ;

Is the same as

sh:property [

            sh:path concept_schema:preferred_specialty ;

            sh:minCount 0;

          ] ;

The same with the other shape.

So, indeed, irrespective of how many values you have, your data conforms to both shapes and it must conform to only one of them.

Add sh:minCount 1 to both property shapes. Then, you get a violation only of you have both properties populated or neither properties populated.



    On Sep 15, 2020, at 2:24 PM, cbur...@healthwise.org
    <http://healthwise.org/> <cburn...@healthwise.org
    <mailto:cburn...@healthwise.org>> wrote:

    Thanks for the help. I was indeed confused about the meaning of
    *sh:disjoint*.

    I have written a basic *sh:xone *constraint like this:

      sh:xone (

          [

            sh:property [

                sh:path concept_schema:preferred_specialty ;

              ] ;

          ]

          [

            sh:property [

                sh:path concept_schema:preferred_specialty_inferred ;

              ] ;

          ]

        ) ;

    .

    where *concept_schema:preferred_specialty* has only explicit
    values and *concept_schema:preferred_specialty_inferred* has only
    inferred values.

    But now, in my concept data, whether 0, 1, or 2 of these
    properties has a value, I am still getting a constraint violation
    saying:

    *Value has 2 shapes out of 2 in the sh:xone enumeration*

    What could I be doing wrong?

    On Friday, September 11, 2020 at 6:10:17 PM UTC-7 Holger Knublauch
    wrote:

        On 12/09/2020 09:21, Irene Polikoff wrote:



                On Sep 11, 2020, at 6:02 PM, cbur...@healthwise.org
                <http://healthwise.org/> <cbur...@healthwise.org> wrote:

                These questions are more about SHACL than about EDG
                per se, but I think you experts will be able to help me.

                1. *sh:disjoint*: I have used sh:disjoint to declare
                that the sh:path of a property shape is disjoint with
                another another property, like this:

                ex:Concept-property

                   a sh:PropertyShape ;

                   sh:path ex:property ;

                   sh:disjoint ex:property2 .

                Testing this out in EDG 6.4.1 yields no constraint
                violations when I assign values to a certain instance
                of ex:Concept for both ex:property and ex:property2.
                Have I set this up incorrectly, or do I need to do
                something else to make EDG raise warnings in this
                situation?

            Disjoint means that a given resource cannot have the same
            value for ex; property as for ex:property2.  E.g., a pref
            label for resource X can’t be the same as alLabel for
            resource X. Is this what you meant?

        In case you're stuck, a minimal complete example would allow
        us to reproduce it.



            Or do you mean something else i.e., it either have a value
            for ex:property or a value for ex:property2 e.g., either
            foaf:givenName or foaf:firstName, but not both. If so,
            then use xone:
            https://www.w3.org/TR/shacl/#XoneConstraintComponent
            
<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.w3.org%2FTR%2Fshacl%2F%23XoneConstraintComponent&data=02%7C01%7Ccburnett%40healthwise.org%7C29db85d271374b14b53808d859a6129d%7Ccee5d4e942e548c28a033406fd5b9242%7C0%7C0%7C637357917099396946&sdata=QUcKJ7zEoqFcpOftjcteZ%2B%2BEKoR3swUtnZmPMn%2FMgvw%3D&reserved=0>

                2. *Inferring data: *Suppose ex:property and
                ex:property2 are disjoint for a given shape, as
                specified above. If an instance of ex:Concept has
                *exactly one value *for either ex:property or
                ex:property2, I would like to infer that this is the
                value of ex:property3. How could this be modeled?

            The exact expression depends on your answer to the first
            question.

                2. *A different property pair constraint:* This case
                is nearly the opposite of the above. Suppose I wish to
                specify that any value of ex:property4 (which has
                sh:maxCount 1) *must be* one of the values of
                ex:property5 (which has no sh:maxCount). How would I
                express that? (I don't see a way to do it using
                sh:equals.)

            SPARQL-based constraint

        Yes or dash:subSetOf already implements this SPARQL constraint:

        http://datashapes.org/constraints.html#SubSetOfConstraintComponent
        
<https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fdatashapes.org%2Fconstraints.html%23SubSetOfConstraintComponent&data=02%7C01%7Ccburnett%40healthwise.org%7C29db85d271374b14b53808d859a6129d%7Ccee5d4e942e548c28a033406fd5b9242%7C0%7C0%7C637357917099406940&sdata=cj1sbmpSxLsMip%2Fog3p5%2Fh8zEoT3TSNCczd58mT9FI8%3D&reserved=0>

        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-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/5d0403df-9dec-4828-9d84-edc81c78eb6cn%40googlegroups.com
    
<https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Ftopbraid-users%2F5d0403df-9dec-4828-9d84-edc81c78eb6cn%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=02%7C01%7Ccburnett%40healthwise.org%7C29db85d271374b14b53808d859a6129d%7Ccee5d4e942e548c28a033406fd5b9242%7C0%7C0%7C637357917099406940&sdata=7zC30Id8TW6xe7t54XP1A5BzyaDF9x63PcZkpq3HZLw%3D&reserved=0>.

--
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/04w-ddzQ81I/unsubscribe <https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Ftopic%2Ftopbraid-users%2F04w-ddzQ81I%2Funsubscribe&data=02%7C01%7Ccburnett%40healthwise.org%7C29db85d271374b14b53808d859a6129d%7Ccee5d4e942e548c28a033406fd5b9242%7C0%7C0%7C637357917099416934&sdata=JGEsVyaOFv69QvS9q5%2BWoA4%2BiNRsjYj31bYjM8O0SOY%3D&reserved=0>. To unsubscribe from this group and all its topics, 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/1F2112E2-0562-45D2-9DA2-73A8DCAAE555%40topquadrant.com <https://nam02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Ftopbraid-users%2F1F2112E2-0562-45D2-9DA2-73A8DCAAE555%2540topquadrant.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=02%7C01%7Ccburnett%40healthwise.org%7C29db85d271374b14b53808d859a6129d%7Ccee5d4e942e548c28a033406fd5b9242%7C0%7C0%7C637357917099416934&sdata=9oX3yIyZHS%2BYIlnUsMA6ffzIhBZKj5irw1UDcqlQBvE%3D&reserved=0>.

--
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/MWHPR19MB159878A315C48958FDC9DDD5B7200%40MWHPR19MB1598.namprd19.prod.outlook.com <https://groups.google.com/d/msgid/topbraid-users/MWHPR19MB159878A315C48958FDC9DDD5B7200%40MWHPR19MB1598.namprd19.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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/210342da-f373-38cc-e4f3-fea6899a175f%40topquadrant.com.

Reply via email to