This script pulls json schema/validation files from specifications as listed in the specifications_list file and compiles them into a single update file for consumption/display by the DDE Schema Playground. It will automatically check for updates to the list of profiles and types, aggregate them and update them to the corresponding bioschemas namespace in the Data Discovery Engine
DO NOT EDIT the bioschemas.json file directly. Updates to this file will be over-written by the updates to the specification files listed in the specifications_list.txt file.
- Fork the bioschemas specification repository
- Go to the specification folder of interest
- add your updated json specification to the jsonld folder of the appropriate specification folder and name it '{Class}{version}-RELEASE.json' or '{Class}{version}-DRAFT.json'. Deprecated specifications should be named '{Class}_{version}-DEPRECATED.json'.
Note that this repository automatically receives updates from Sahar's script for converting the jsonld files in the Specifications Repository into the bioschemas website pages. These updates trigger the following scripts so that manual updates should NOT be needed these updates include:
- Identifying the files updated from Sahar's script
- Checking if these updated files are the newest versions of specifications stored in the DDE
- Automatically updating the the specification in the DDE
If you do not see your updated specification in the DDE, you may need to manually override the appropriate table (see below)
- Go to https://discovery.biothings.io/registry
- Search for "bioschemas". There are several version of bioschemas in the DDE. Be sure to start with the one that's most appropriate for your purpose:
bioschemas
- Will give you the most recent RELEASED version of a PROFILEbioschemasdrafts
- Will give you the most recent DRAFT version of a PROFILEbioschemastypes
- Will give you the most recent RELEASED version of a TYPEbioschemastypesdrafts
- Will give you the most recent DRAFT version of a TYPEbioschemasdeprecated
- Will give you the most recent version of a DEPRECATED class (PROFILE or TYPE)
- Select the existing bioschema profile/type that you'd like to update
- Click on the "extend" icon (note that you will have to use a temporary namespace, like 'bioschemastemp')
- Select all the properties that you'd like to keep
- Add new properties as needed
- Toggle the validation editor and add validation for any new properties. Also, edit validations for existing properties if there was a change in the cardinality, marginality, expected types, or allowed vocabularies.
- Download/export your updated schema jsonld file to your desktop or to github
- If you'd like, you can use a simple text editor to do a simple find/replace and change your temporary namespace to the appropriate bioschema namespace (see #2 in this section). While this is not required because the automated merging script will do this for you, you will have to ensure you include the temporary namespace when you update the appropriate list if you do not follow this step). Note that if you are creating or editing a type, you will need to DELETE the $validation section created by the DDE
- Move a copy of your json schema into the appropriate bioschemas specification folder (see "To update a specification via github)
- View your schema via the DDE. Visit: https://discovery.biothings.io/schema-playground and click on
Register Schema
enter the url for your jsonld schema file and clickLet's Go
. NOTE - You should do a find/replace to ensure that the namespace isbioschemas
to see how it is expected to appear when it's integrated with the rest of bioschemas (step 9). Also, if you are using the DDE to update a draft by extending, you will want to change the parent class to match the parent class of what you extended from. Eg- If you are creating a new draft ofDataset
frombioschemas:Dataset
, the DDE will set the parent of yourDataset
to bebioschemas:Dataset
. If you're trying to update the currentbioschemas:Dataset
, then your parent class should actually beschema:Dataset
which is the parent ofbioschemas:Dataset
.
- Fork the bioschemas_DDE repository
- Edit the appropriate file in your fork<-- This will trigger the generation of the json files via github actions in your fork of the repository (note that if your schema used a temporary namespace, you should use that namespace in the specification file, so the script does a proper replacement in the merged bioschemas.json). The file names are as follows:
profile_list.txt
: All RELEASED PROFILES in this list will be added to thebioschemas.json
(bioschemas
namespace)draft_profile_list
: All DRAFT PROFILES in this list will be added to thebioschemasdrafts.json
(bioschemasdrafts
namespace) *type_list.txt
: All RELEASED TYPES in this list will be added to thebioschemastypes.json
(bioschemastypes
namespace) *draft_type_list.txt
: All DRAFT Types in this list will be added to thebioschemastypesdrafts.json
(bioschemastypesdrafts
namespace) *deprecated.txt
: ALL DEPRECATED classes (PROFILES or TYPES) in this list will be added to thebioschemasdeprecated.json
(bioschemasdeprecated
namespace)
- Go to https://discovery.biothings.io/schema-playground and click on "Register Schema" (don't worry, you won't be registering anything). Paste the link to YOUR generated bioschemas.json file into the schema viewer and click
Let's go
- Click on the specification you updated to review how it appears in the DDE.
- Edit/iterate as needed. If you are satisfied with your specification, push your updates to the bioschemas_DDE repository
- If using the DDE Schema Playground to create the new specification, you will not be able to use the reserved bioschemas namespaces. These namespaces include:
bioschemas
(released profiles),bioschemasdrafts
(draft profiles),bioschemastypes
(released types),bioschemastypesdrafts
(draft types), andbioschemasdeprecated
(deprecated profiles and types). This is fine, as the aggregator has a function for handling this. Just be sure to include the temporary namespace in the specifications_list file. - add the new json schema file into an appropriate folder/directory within the Bioschemas Specifications repository and name it
{Class}_{version}-{RELEASE or DRAFT}.json
(If a class is deprecated, include the term {DEPRECATED} - IMPORTANT--This should step should be done AFTER the new json schema file has been created. Better yet, load it with the DDE schema viewer to ensure that it is working as expected. If everything is working, update the appropriate list file (in this repository) with the url to the json file and other requested information. Note that the list files are tab-delimited
- The DDE Schema Playground is strict when adhering to schema.org standards. Hence, properties must follow the schema.org naming conventions to work properly. You will be able to create properties which have non-standard names; HOWEVER, such properties will trigger errors when you try to view your schema in the schema viewer.
- If the expected type is a bioschemas type or profile, you should manually enter "{namespace}:{Class name}". The namespace should be one of
bioschemas
(Released Profiles),bioschemastypes
(Released Drafts), etc. This will allow the property to properly reference the expected class in the greater schema. That said, IF the type/profile being referenced is NOT yet available in the DDE, it will occassionaly cause an error. If that happens, you can bypass this issue by creating a dummy/placeholder class for the referenced class in your specification. - Although Bioschemas specifies
@id
,@type
,@context
as minimally required properties, these are properties required by jsonld and do not follow schema.org property naming conventions. For this reason, although they are required for all profiles and types, they cannot be included/viewed as properties within the DDE as they are requirements inherited from jsonld formatting and not schema.org - Bioschemas also specifies
dct:conformsTo
as a minimally required property as a class. This will be automatically added to all classes via the merging script, so it should be omitted when creating a new specification or extending from an existing Bioschemas class. - All defined classes will automatically have the schema version included. This will utilize the
schema:schemaVersion
property for which the value will be an array of versioned schemas referenced.