Thanks to all for your replies, I very much appreciate it.

You could write and be able to reuse share if written as a property shape referred to directly:

"""
regen:C02-ProjectShapeX a sh:NodeShape ;
  sh:targetClass regen:C02-Project ;
  sh:property regen:ProjectTypePropertyShape
.

# Property shapes can have URIs!
regen:ProjectTypePropertyShape
    # rdf:type not necessary
    rdf:type a sh:PropertyShape ;
    sh:path regen:projectType ;
    sh:minCount 1 ;
    sh:maxCount 1 ;
    sh:minLength 1 ;
    sh:datatype xsd:string ;
    sh:group regen:ProjectPageMetadataGroup ;
.
"""

will give

"MinLengthConstraint[1]: String too short: "

If written this way, all the violations of regen:ProjectTypePropertyShape will generate messages so you can get one for minLength and one for maxCount, say, if they both fail.

This set me down a path that is working quite well for me. I did have to make some adjustments, but I'm quite happy with where I ended up.

Indeed, having property shapes with URI's is also a nicety that I think is a benefit for our schema as well. Thanks for pointing that out. This info adds some (https://book.validatingrdf.com/bookHtml011.html#sec125).

For posterity, I've end up with this as my schema (a little simplified):

@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix regen: <http://regen.network/> .
@prefix qudt: <http://qudt.org/schema/qudt/> .
@prefix unit: <http://qudt.org/vocab/unit/> .
@prefix geojson: <https://purl.org/geojson/vocab#> .
@prefix dash: <http://datashapes.org/dash#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

regen:C02-ProjectShape a sh:NodeShape ;
  sh:targetClass regen:C02-Project ;
  sh:property regen:NamePropertyShape ;
  sh:property regen:DescriptionPropertyShape ;
.

regen:NamePropertyShape sh:path schema:name ;
  sh:minCount 1 ;
  sh:maxCount 1 ;
  sh:minLength 1 ;
  sh:datatype xsd:string ;
  sh:group regen:ProjectPageBasicInfoGroup ;
.

regen:DescriptionPropertyShape sh:path schema:description ;
  sh:maxLength 1400 ;
  sh:datatype xsd:string ;
  sh:group regen:ProjectPageDescriptionGroup ;
.

This satisfies my needs nicely by providing a way to dedupe particular fields.

Reply via email to