Yes, that was my original approach, but since the path is reported as a
blank node, the alternativePath itself, and not the specific alternative
that tripped the violation, I've lost the path information.  I know it is
an unusual and extraneous demand, but legacy code wants to know ....

using the message to decide is an awkward possibility. It means
dual-purposing a data item and it also forms a technical debt should the
application someday support other languages.

I also tried convoluted paths in hopes of chaining inversePath with the
alternate as a path list, and then using that in an sh:or like

sh:path schema:ratingCount ;
sh:or (
    [ sh:path ( [ sh:inversePath schema:ratingCount ] schema:reviewCount )
; minCount 1 ]
    [ sh:minCount 1 ]
);

but needless to say that didn't work either.  It seemed like a good idea at
the time, and I'm not at all certain I fully understand inversePath, but
when the engine gets to the second sh:or case I think it is saying that it
doesn't know who this minCount is referencing.

On Wed, Feb 19, 2020 at 8:21 PM Holger Knublauch <[email protected]>
wrote:

> I think a path of ratingCount|reviewCount with sh:minCount 1 is the
> cleanest approach. So if the blank node isn't very meaningful yet, maybe
> you'd need to adjust the results display accordingly? You could also
> specify a nice sh:message to explain what's really going on at the property
> shape.
>
> ex:AggregateRatingShape
>     a sh:NodeShape ;
>     sh:targetClass schema:AggregateRating ;
>     sh:property [
>         sh:path [ sh:alternativePath ( schema:ratingCount
> schema:reviewCount ) ] ;
>         sh:minCount 1 ;
>         sh:message "AggregateRating can have either or both of ratingCount
> and reviewCount" ;
>     ] .
>
> Of course you'd also need the individual property shapes for the two
> properties, with no sh:minCount.
>
> Alternatively, use sh:or at the node shape, yet that might even be more
> complicating.
>
> Holger
>
>
> On 20/02/2020 07:31, Gary Murphy wrote:
>
> I have an application where I use the validation sh:resultPath to display
> violation messages, but I've hit a conundrum with dependent/contingent
> properties
>
> a simple example: schema:AggregateRating can have either or both of
> ratingCount and reviewCount, with a structure as follows:
>
>   {
>     "@context": { "@vocab": "http://schema.org/"; },
>    "@type": "AggregateRating",
>     "ratingCount": 25,
>     "ratingValue": "3.5",
>     "reviewCount": 5,
>     "@id": "http://schemaapp.com/db/SchemaApp#AggregateRating";
> }
>
> what I would like to do is to attach a PropertyShape with a sh:path
> schema:reviewCount that will pass if either (or both) properties are
> present, but return a violation (with sh:resultPath schema:reviewCount) if
> both are missing
>
> It was very easy to phrase using sh:alternativePath in a NodeShape, but
> that gives the sh:alternativePath blank node as the resultPath.  I might be
> stuck with that, but hoping there's a way to do it the way I need
> --
> Gary Lawrence Murphy <[email protected]> - Hunch Manifest, 15 Wyndham N
> 'C', Guelph
> --
> 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/CADnyxpsmyhQ7j7-qYDdu87iPvQ6Fo09je97%3DStwqzK3cj5N55Q%40mail.gmail.com
> <https://groups.google.com/d/msgid/topbraid-users/CADnyxpsmyhQ7j7-qYDdu87iPvQ6Fo09je97%3DStwqzK3cj5N55Q%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/a015277b-e436-b190-1893-fa5507b6f820%40topquadrant.com
> <https://groups.google.com/d/msgid/topbraid-users/a015277b-e436-b190-1893-fa5507b6f820%40topquadrant.com?utm_medium=email&utm_source=footer>
> .
>


-- 
Gary Lawrence Murphy <[email protected]> - Hunch Manifest, 15 Wyndham N
'C', Guelph

-- 
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/CADnyxpvY_uEHmYACMAGJSZA%2BV3%3DBds%3D83jP7s96EhEZMmTsNGA%40mail.gmail.com.

Reply via email to