W3C home > Mailing lists > Public > public-shex-dev@w3.org > November 2015

comparison with JSON schema

From: Eric Prud'hommeaux <eric@w3.org>
Date: Mon, 2 Nov 2015 16:33:06 -0500
To: public-shex-dev@w3.org
Message-ID: <20151102213304.GA31633@w3.org>
It's been a year so I thought I'd look back through JSON schema to see what it can do that ShEx can't:

  1 in-document declaration of ID, รก la xsi:schemaLocation

  2 format "macros" for date-time, email, hostname, ipv4, ipv6, uri (RFC3986)

  3 multipleOf -- tested number must be multiple of argument.

  4 {min,max}Properties -- control how man total properties are expected for an object.

  5 dependencies -- kind of like a less expressive variant of FHIR discriminators, dependencies provides conditional dependencies. An RDF analogy would be
      dependencies: { "foaf:givenName": [ "foaf:familyName" ],
                      "foaf:familyName": [ "foaf:givenName" ] }
    Note that there's no else as in
      { foaf:givenName, foaf:familyName | foaf:name }

    Could a unidirectional depenency like:
      dependencies: { "foaf:givenName": [ "foaf:familyName" ] }
    be represented like:
      "anyOf" [
        { "requiredProperties" [ "foaf:givenName", "foaf:familyName" ] },
        { "requiredProperties" [  ] },
    or in ShEx like:?
      { foaf:givenName, foaf:familyName | foaf:familyName? }

  6 uniqueItems -- entries in an array are unique.

  7 default -- default value for a missing property (This can go in the ShEx grammar with an "=" token before it).

Of course there's stuff like "type":"object" and "type":"array" that simply doesn't apply to the RDF data model.

office: +1.617.599.3509
mobile: +

Feel free to forward this message to any list for any purpose other than
email address distribution.

There are subtle nuances encoded in font variation and clever layout
which can only be seen by printing this message on high-clay paper.
Received on Monday, 2 November 2015 21:33:15 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 4 June 2019 11:00:16 UTC