...
Before we look at the definition of our Example.json let's first look at the definition of our new VertebrateOrganType.json. For this example we want to use the Basic Vertebrate Anatomy ontology to define the valid values for Organs:
VertebrateOrganType.json
Code Block |
---|
{ "type":"string", "format":"uri", "enum":[ "XQUERY": "doc(http://rest.bioontology.org/bioportal/concepts/4531?conceptid=tbio:Organ&light=1&apikey=2fb9306a-7f3f-477a-821e-e3ccd7356a18)/success/data/classBean/relations/entry[string=Subclass]/list/classBean/fullId" ] ] } |
In this example, the enumeration values are defined by an XQuery that is used to get the "fullId" (URIs) of all Sub-classes of the Term "Organ" using the XML returned from NCBO's BioPortal Term services. Here is the XML returned by the term service for this exampl: http://rest.bioontology.org/bioportal/concepts/4531?conceptid=tbio:Organ&light=1&apikey=2fb9306a-7f3f-477a-821e-e3ccd7356a18.
Assuming the XQuery is setup correctly, the effective enum definition for this type would be"
...
Now that we have defined an Annotation Type for Organ using the ontology we can use this type in the definition of the entity.
Here is our definition of our example Entity:
Example.json
Code Block |
---|
{ "extends":"org/sagebionetworks/entity/type/Entity.json" "name":"Product", "properties":{ "id":{ "type":"number", "description":"Example identifier", "required":true }, "name":{ "description":"Name of the Example", "type":"string", "required":true }, "organ":{ "$ref":"org/sagebionetworks/annotation/types/VertebrateOrganType.json" } }, } |
The first thing to point out about our Example.json is that it extends Entity.json, which makes it a Synapse Entity. This implies it inherits all of its values from the base Entity. The second thing to point out is that the "organ" property is defined using the annotation type we created earlier.
...