Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.
This repository was archived by the owner on Oct 22, 2025. It is now read-only.

Figure out a pattern for cutting down noisy validation errors #39

Description

@danbri

I forget the terminology, but the AND/NOT/OR complexity here serves to suppress errors that are downstream of some more fundamental error. @ericprud et al have plans for doing this within ShEx in more standardized ways, so the actual intended shape content doesn't get lost in all the boolean trickery.

PREFIX : <http://schema.org/>
PREFIX validate: <https://google.com/search/validation/valid>

<S1> {
  :url . + %validate:url{console.log('some url checking code here')%}
} AND {
  :datePublished . ? %validate:date-time{console.log('some datetime checking code here')%}
} AND {
  :claimReviewed . 
} AND {
  :itemReviewed {
    a [:CreativeWork]
  } AND (
    NOT {
      a [:CreativeWork]
    } OR {
      :author (
        {
          a [:Organization]
        } OR {
          a [:Person]
        }
      ) AND (
        NOT (
          {
            a [:Organization]
          } OR {
            a [:Person]
          }
        ) OR {
          :name . ?
        }
      )?
    } AND {
      :datePublished . ? %validate:date-time{console.log('some datetime checking code here')%}
    }
  )?
} AND {
  :author (
    {
      a [:Organization]
    } OR {
      a [:Person]
    }
  ) AND (
    NOT (
      {
        a [:Organization]
      } OR {
        a [:Person]
      }
    ) OR (
      {
        :name . 
      } OR {
        :url . 
      }
    ) AND {
      :url . * %validate:url{console.log('some url checking code here')%}
    }
  )?
} AND {
  :reviewRating {
    a [:Rating]
  } AND (
    NOT {
      a [:Rating]
    } OR {
      :alternateName . 
    } AND (
      (
        NOT {
          :name . 
        } OR {
          :alternateName . ?
        }
      ) AND (
        NOT (
          NOT {
            :name . 
          }
        ) OR {
          :alternateName . +
        }
      )
    ) AND NOT (
      {
        :alternateName . 
      } AND {
        :name . 
      }
    ) AND (
      NOT (
        (
          {
            :ratingValue . 
          } OR {
            :bestRating . 
          } OR {
            :worstRating . 
          }
        ) AND NOT (
          {
            :ratingValue /-1/ 
          } AND {
            :bestRating /-1/ 
          } AND {
            :worstRating /-1/ 
          }
        )
      ) OR {
        :ratingValue /([0-9]+[\.,]?[0-9]*)\/([0-9]+[\.,]?[0-9]*)/  OR /([0-9]+[\.,]?[0-9]*)%/  OR /([0-9]+[\.,]?[0-9]*)/ +
      } AND (
        NOT {
          :ratingValue /([0-9]+[\.,]?[0-9]*)/ +
        } OR {
          
        } %validate:rating%
      )
    )
  )+
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions