{
    "additionalProperties": false,
    "definitions": {
        "characteristic": {
            "additionalProperties": false,
            "properties": {
                "ontologyTerms": {
                    "items": {
                        "type": "string"
                    },
                    "type": "array"
                },
                "tag": {
                    "description": "The tag indicating the source of the attribute, not required in submission",
                    "type": "string"
                },
                "text": {
                    "type": "string"
                },
                "unit": {
                    "description": "The unit associated with the attribute value",
                    "type": "string"
                }
            },
            "type": "object"
        },
        "contact": {
            "additionalProperties": false,
            "description": "Object representing a contact reference for the sample",
            "properties": {
                "Affiliation": {
                    "type": "string"
                },
                "E-mail": {
                    "type": "string"
                },
                "FirstName": {
                    "type": "string"
                },
                "LastName": {
                    "type": "string"
                },
                "MidInitials": {
                    "type": "string"
                },
                "Name": {
                    "type": "string"
                },
                "Role": {
                    "type": "string"
                },
                "URL": {
                    "type": "string"
                }
            },
            "title": "Contact",
            "type": "object"
        },
        "external_reference": {
            "additionalProperties": false,
            "description": "Object representing a link to a repository or page associated with the sample itself, e.g. a link to an ENA record ",
            "properties": {
                "duo": {
                    "description": "Data use ontology terms ",
                    "items": {
                        "description": "Data use condition https://ega-archive.org/data-use-conditions",
                        "pattern": "^DUO:[0-9]{7}$",
                        "type": "string"
                    },
                    "type": "array"
                },
                "url": {
                    "type": "string"
                }
            },
            "required": [
                "url"
            ],
            "title": "BioSamples external reference",
            "type": "object"
        },
        "organisation": {
            "additionalProperties": false,
            "description": "Object representing an organization related to the sample in some way",
            "properties": {
                "Address": {
                    "type": "string"
                },
                "E-mail": {
                    "type": "string"
                },
                "Name": {
                    "type": "string"
                },
                "Role": {
                    "type": "string"
                },
                "URL": {
                    "type": "string"
                }
            },
            "title": "Organisation",
            "type": "object"
        },
        "publication": {
            "additionalProperties": false,
            "description": "Object representing a publication associated to the sample",
            "properties": {
                "doi": {
                    "type": "string"
                },
                "pubmed_id": {
                    "type": "string"
                }
            },
            "title": "Publication",
            "type": "object"
        },
        "relationship": {
            "additionalProperties": false,
            "description": "Relationship object connecting two BioSamples accessions",
            "properties": {
                "source": {
                    "description": "The sample accession where the relation starts from",
                    "pattern": "^SAM(D|N|E([AG]?))[0-9]+$",
                    "type": "string"
                },
                "target": {
                    "description": "The sample accession where the relation targets to",
                    "pattern": "^SAM(D|N|E([AG]?))[0-9]+$",
                    "type": "string"
                },
                "type": {
                    "enum": [
                        "derived from",
                        "same as",
                        "has member",
                        "child of"
                    ],
                    "type": "string"
                }
            },
            "required": [
                "source",
                "type",
                "target"
            ],
            "title": "BioSamples relationship",
            "type": "object"
        },
        "structured_data": {
            "additionalProperties": false,
            "description": "A structured data item, e.g. an antibiogram table",
            "properties": {
                "content": {
                    "type": [
                        "array",
                        "object"
                    ]
                },
                "schema": {
                    "description": "The URL reference to the schema",
                    "pattern": "(http|https)://www(dev)?.ebi.ac.uk/biosamples/schemas/structured/.*",
                    "type": "string"
                },
                "type": {
                    "description": "The type of structured data this item is",
                    "enum": [
                        "AMR"
                    ],
                    "type": "string"
                }
            },
            "required": [
                "type",
                "schema",
                "content"
            ],
            "title": "BioSamples structured data item",
            "type": "object"
        }
    },
    "description": "BioSamples database sample json schema",
    "examples": [
        {
            "accession": "SAMEA1607017",
            "characteristics": {
                "description": [
                    {
                        "text": "MicMa107_PT_180608 Early stage breast cancer patient."
                    }
                ],
                "disease state": [
                    {
                        "text": "early-stage breast cancer"
                    }
                ],
                "organism": [
                    {
                        "ontologyTerms": [
                            "http://purl.obolibrary.org/obo/NCBITaxon_9606"
                        ],
                        "tag": "attribute",
                        "text": "Homo sapiens"
                    }
                ],
                "organism part": [
                    {
                        "text": "breast cancer tumor"
                    }
                ],
                "patient identifier": [
                    {
                        "text": "MicMa107"
                    }
                ],
                "sample source name": [
                    {
                        "text": "fresh-frozen breast cancer tumor"
                    }
                ],
                "sample title": [
                    {
                        "text": "Breast cancer, MicMa107_PT_180608 (244k)"
                    }
                ],
                "type of isolated tumor cells": [
                    {
                        "text": "breast cancer tumor"
                    }
                ]
            },
            "contact": [
                {
                    "Name": "Anna Obenauf"
                },
                {
                    "Name": "Anne-Lise B\u00f8rresen-Dale"
                },
                {
                    "Name": "Bj\u00f8rn Naume"
                },
                {
                    "Name": "Eldri Due"
                },
                {
                    "Name": "Elin Borgen"
                },
                {
                    "Name": "Ida Schneider"
                },
                {
                    "Name": "Inga Rye"
                },
                {
                    "Name": "Jochen Geigl"
                },
                {
                    "Name": "Klaus Pantel"
                },
                {
                    "Name": "Knut Liest\u00f8l"
                },
                {
                    "Name": "Lars Baumbusch"
                },
                {
                    "Name": "Michael Speicher"
                },
                {
                    "Name": "Ole Lingj\u00e6rde"
                },
                {
                    "Name": "Oliver Mauermann"
                },
                {
                    "Name": "Randi Mathiesen"
                },
                {
                    "Name": "Renathe Fjelldal"
                },
                {
                    "Name": "Sabine Riethdorf"
                }
            ],
            "domain": "self.example",
            "name": "source GSM1038808 1",
            "organization": [
                {
                    "Name": "Institute for cancer research Oslo University Hospital Radiumhospitalet",
                    "Role": "submitter "
                }
            ],
            "publications": [
                {
                    "pubmed_id": "21935921"
                }
            ],
            "relationships": [
                {
                    "source": "SAMEG118117",
                    "target": "SAMEA1607017",
                    "type": "has member"
                }
            ],
            "release": "2012-11-19T00:00:00Z",
            "taxId": 9606,
            "update": "2019-07-24T08:11:34.499Z"
        }
    ],
    "properties": {
        "accession": {
            "description": "Sample accession",
            "pattern": "^SAM(D|N|E([AG]?))[0-9]+$",
            "type": "string"
        },
        "characteristics": {
            "description": "All the characteristics associated to the sample",
            "items": {
                "$ref": "#/definitions/characteristic"
            },
            "type": "array"
        },
        "contact": {
            "description": "Contact information of the people associated with the sample",
            "items": {
                "$ref": "#/definitions/contact"
            },
            "type": "array"
        },
        "data": {
            "description": "Contains the structured data associated with a sample",
            "items": {
                "$ref": "#/definitions/structured_data"
            },
            "type": "array"
        },
        "domain": {
            "description": "Sample AAP domain membership",
            "type": "string"
        },
        "externalReferences": {
            "description": "Array of references to external resources, for example a link to ENA data, EGA data, etc.",
            "items": {
                "$ref": "#/definitions/external_reference"
            },
            "type": "array"
        },
        "name": {
            "description": "The sample name, or an alias, or another id",
            "type": "string"
        },
        "organization": {
            "description": "Organization information associated with the sample",
            "items": {
                "$ref": "#/definitions/organisation"
            },
            "type": "array"
        },
        "publications": {
            "description": "Pubblications associated with the sample",
            "items": {
                "$ref": "#/definitions/publication"
            },
            "type": "array"
        },
        "relationships": {
            "description": "Sample relationships with other samples in BioSamples",
            "items": {
                "$ref": "#/definitions/relationship"
            },
            "type": "array"
        },
        "release": {
            "_format": "date-time",
            "description": "Sample relase date-time in ISO8601 format. Release date in the future means the sample is private",
            "type": "string"
        },
        "taxId": {
            "description": "BioSamples generates the taxonID automaticly. Instead of providing the taxId here, users should provide organism information in Field 'characteristics'",
            "type": "integer"
        },
        "update": {
            "_format": "date-time",
            "description": "Sample last update date-time in ISO8601 format. This is automatically set from the server on submission",
            "type": "string"
        }
    },
    "required": [
        "name",
        "domain",
        "release"
    ],
    "type": "object"
}