Making Use of Inheritance when generating GraphQL Schemas

Hi Evren,

Thanks a lot for your reply. I'll try to provide a minimal example.

shapes.json contains SHACL shapes for schema:Thing and schema:Person (we are using sh:targetClass). ontology.json expresses the subclass relation between person and thing.
Now when this data is loaded using load_shapes.sh, I get the following result:

schema {
  query: QueryType
}

type Organization @iri(value : "http://schema.org/Organization") {
  iri: ID!
}

type Person @iri(value : "http://schema.org/Person") {
  additionalName: [String] @iri(value : "http://schema.org/additionalName")
  address: String @iri(value : "http://schema.org/address")
  affiliation: [Organization]! @iri(value : "http://schema.org/affiliation")
  birthDate: String @iri(value : "http://schema.org/birthDate")
  deathDate: String @iri(value : "http://schema.org/deathDate")
  email: String @iri(value : "http://schema.org/email")
  familyName: String! @iri(value : "http://schema.org/familyName")
  givenName: String! @iri(value : "http://schema.org/givenName")
  honorificPrefix: String @iri(value : "http://schema.org/honorificPrefix")
  honorificSuffix: String @iri(value : "http://schema.org/honorificSuffix")
  iri: ID!
  jobTitle: [String]! @iri(value : "http://schema.org/jobTitle")
}

type QueryType {
  Organization: Organization
  Person: Person
  Thing: Thing
}

type Thing @iri(value : "http://schema.org/Thing") {
  alternateName: [String] @iri(value : "http://schema.org/alternateName")
  description: ID @iri(value : "http://schema.org/description")
  identifier: ID @iri(value : "http://schema.org/identifier")
  image: ID @iri(value : "http://schema.org/image")
  iri: ID!
  name: String! @iri(value : "http://schema.org/name")
  sameAs: [ID] @iri(value : "http://schema.org/sameAs")
  url: [ID] @iri(value : "http://schema.org/url")
}

Regarding the generated schema, I have the following comments:

  1. I'd expect person to have also the properties / fields defined for thing.

  2. I also noticed that QueryType lacks the @iri decorators resulting in SPARQL queries that return no result, same as described here.

  3. How is sh:or handled? If two datatypes are allowed on a property's range, will there be a union in the schema?

I've gained some experience in transforming the shapes graph for different purposes. Maybe the shapes need some more info (they do not contain inheritance info directly, only indirectly via their target classes)?

Thanks a lot for your feedback.

Kind regards,

Tobias

shapes.json (8.8 KB)
ontology.json (1.3 KB)
load_shapes.sh (352 Bytes)