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] <mailto:[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] <mailto:[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.

Reply via email to