JSON Schema for Concepts
Using Concepts in the JSON schema of an Entity
Currently, we are using JSON schemas to define Entities in Synapse according to the following spec: draft-zyp-json-schema-03 . As mentioned in the parent document we plan to use a SKOS Concept to define the value domain of certain Entity properties. So how do we write the JSON schema to achieve this goal?
Tissue Example
Lets assume that each Layer entity has data that was derived from a single tissue type. For example, one layer might have data derived from "brain" tissue, while another layer might have data derived from the "Adrenal Cortex". Therefore, we want to add a property named "tissueType" to the Layer JSON schema to capture this information for all layers. Further more, we do not want to allow any arbitrary string for the values of this tissueType property. Instead we want to constrain the values of the tissueType property to be any URI from the Synapse Ontology that belongs to the "tissue" concept:
http://bioportal.bioontology.org/ontologies/46699/tissue
Note the Synapse Ontology ID = 46699
So how should this idea be represented int the JSON Schema for a Layer?
Proposal
We are proposing to use the links attribute of the JSON schema with 'rel':'describedby' and href: <concept_url>:
{ "links": [ { "rel": "describedby" "href": "<concept_url>" }, ] }
So here is what the JSON schema would look like for Layer:
{ "description":"JSON schema for Layer POJO", "implements":[ { "$ref":"org.sagebionetworks.repo.model.Locationable" }, { "$ref":"org.sagebionetworks.repo.model.HasPreviews" }, ], "properties":{ "publicationDate":{ "type":"string", "format":"date-time", "description":"Date this layer was published" }, "releaseNotes":{ "type":"string", "description":"Free text about layer" }, ... "tissueType":{ "type":"uri", "description":"Type of tissue for the samples in this layer", "links":[ { "rel":"describedby", "href":"http://bioportal.bioontology.org/ontologies/46699/tissue" }, ], }, ... } }