PREFIX fhir: <http://hl7.org/fhir/> 
PREFIX fhirvs: <http://hl7.org/fhir/ValueSet/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 

# ShEx Version 2.2
IMPORT <Date.shex>
IMPORT <Range.shex>
IMPORT <Ratio.shex>
IMPORT <String.shex>
IMPORT <Boolean.shex>
IMPORT <Integer.shex>
IMPORT <DateTime.shex>
IMPORT <Markdown.shex>
IMPORT <Quantity.shex>
IMPORT <Reference.shex>
IMPORT <Annotation.shex>
IMPORT <Attachment.shex>
IMPORT <Identifier.shex>
IMPORT <Organization.shex>
IMPORT <DomainResource.shex>
IMPORT <BackboneElement.shex>
IMPORT <CodeableConcept.shex>
IMPORT <CodeableReference.shex>
IMPORT <DocumentReference.shex>

start=@<SubstanceDefinition> AND {fhir:nodeRole [fhir:treeRoot]}

# The detailed description of a substance, typically at a level beyond what is used for prescribing
<SubstanceDefinition> EXTENDS @<DomainResource> CLOSED {   
    a [fhir:SubstanceDefinition]?;fhir:nodeRole [fhir:treeRoot]?;

    fhir:identifier @<OneOrMore_Identifier>?;  # Identifier by which this substance 
                                            # is known 
    fhir:version @<String>?;                # A business level edition or 
                                            # revision identifier 
    fhir:status @<CodeableConcept>?;        # Status of substance within the 
                                            # catalogue e.g. active, retired 
    fhir:classification @<OneOrMore_CodeableConcept>?;  # A categorization, high level e.g. 
                                            # polymer or nucleic acid, or food, 
                                            # chemical, biological, or lower 
                                            # e.g. polymer linear or branch 
                                            # chain, or type of impurity 
    fhir:domain @<CodeableConcept>?;        # The applicable usage of the 
                                            # substance, as an example human or 
                                            # veterinary 
    fhir:grade @<OneOrMore_CodeableConcept>?;  # The quality standard, established 
                                            # benchmark, to which substance 
                                            # complies (e.g. USP/NF, BP) 
    fhir:description @<Markdown>?;          # Textual description of the 
                                            # substance 
    fhir:note @<OneOrMore_Annotation>?;     # Textual comment about the 
                                            # substance's catalogue or registry 
                                            # record 
    fhir:manufacturer @<OneOrMore_Reference_Organization>?;  # The entity that creates, makes, 
                                            # produces or fabricates the 
                                            # substance 
    fhir:supplier @<OneOrMore_Reference_Organization>?;  # An entity that is the source for 
                                            # the substance. It may be different 
                                            # from the manufacturer 
    fhir:moiety @<OneOrMore_SubstanceDefinition.moiety>?;  # Moiety, for structural 
                                            # modifications 
    fhir:characterization @<OneOrMore_SubstanceDefinition.characterization>?;  # General specifications for this 
                                            # substance 
    fhir:property @<OneOrMore_SubstanceDefinition.property>?;  # General specifications for this 
                                            # substance 
    fhir:molecularWeight @<OneOrMore_SubstanceDefinition.molecularWeight>?;  # The average mass of a molecule of 
                                            # a compound 
    fhir:structure @<SubstanceDefinition.structure>?;  # Structural information
    fhir:code @<OneOrMore_SubstanceDefinition.code>?;  # Codes associated with the substance
    fhir:name @<OneOrMore_SubstanceDefinition.name>?;  # Names applicable to this substance
    fhir:relationship @<OneOrMore_SubstanceDefinition.relationship>?;  # A link between this substance and 
                                            # another 
    fhir:sourceMaterial @<SubstanceDefinition.sourceMaterial>?;  # Material or taxonomic/anatomical 
                                            # source 
    fhir:nucleicAcid @<SubstanceDefinition.nucleicAcid>?;  # Data items specific to nucleic 
                                            # acids 
    fhir:polymer @<SubstanceDefinition.polymer>?;  # Data items specific to polymers
    fhir:protein @<SubstanceDefinition.protein>?;  # Data items specific to proteins
}  

# Moiety, for structural modifications
<SubstanceDefinition.moiety> EXTENDS @<BackboneElement> CLOSED {   
    fhir:role @<CodeableConcept>?;          # Role that the moiety is playing
    fhir:identifier @<OneOrMore_Identifier>?;  # Identifier by which this moiety 
                                            # substance is known 
    fhir:name @<String>?;                   # Textual name for this moiety 
                                            # substance 
    fhir:stereochemistry @<CodeableConcept>?;  # Stereochemistry type
    fhir:opticalActivity @<CodeableConcept>?;  # Optical activity type
    fhir:molecularFormula @<String>?;       # Molecular formula for this moiety 
                                            # (e.g. with the Hill system) 
    fhir:amount @<Quantity>  OR 
    			@<String>  ?;  # Quantitative value for this moiety
    fhir:measurementType @<CodeableConcept>?;  # The measurement type of the 
                                            # quantitative value 
}  

# General specifications for this substance
<SubstanceDefinition.characterization> EXTENDS @<BackboneElement> CLOSED {   
    fhir:technique @<CodeableConcept>?;     # The method used to find the 
                                            # characterization e.g. HPLC 
    fhir:form @<CodeableConcept>?;          # Describes the nature of the 
                                            # chemical entity and explains, for 
                                            # instance, whether this is a base 
                                            # or a salt form 
    fhir:description @<Markdown>?;          # The description or justification 
                                            # in support of the interpretation 
                                            # of the data file 
    fhir:file @<OneOrMore_Attachment>?;     # The data produced by the 
                                            # analytical instrument or a 
                                            # pictorial representation of that 
                                            # data. Examples: a JCAMP, JDX, or 
                                            # ADX file, or a chromatogram or 
                                            # spectrum analysis 
}  

# General specifications for this substance
<SubstanceDefinition.property> EXTENDS @<BackboneElement> CLOSED {   
    fhir:type @<CodeableConcept>;           # A code expressing the type of 
                                            # property 
    fhir:value @<CodeableConcept>  OR 
    			@<Quantity>  OR 
    			@<Range>  OR 
    			@<Date>  OR 
    			@<Boolean>  OR 
    			@<Attachment>  ?;  # A value for the property
}  

# The average mass of a molecule of a compound
<SubstanceDefinition.molecularWeight> EXTENDS @<BackboneElement> CLOSED {   
    fhir:method @<CodeableConcept>?;        # The method by which the weight was 
                                            # determined 
    fhir:type @<CodeableConcept>?;          # Type of molecular weight e.g. 
                                            # exact, average, weight average 
    fhir:amount @<Quantity>;                # Used to capture quantitative 
                                            # values for a variety of elements 
}  

# Structural information
<SubstanceDefinition.structure> EXTENDS @<BackboneElement> CLOSED {   
    fhir:stereochemistry @<CodeableConcept>?;  # Stereochemistry type
    fhir:opticalActivity @<CodeableConcept>?;  # Optical activity type
    fhir:molecularFormula @<String>?;       # An expression which states the 
                                            # number and type of atoms present 
                                            # in a molecule of a substance 
    fhir:molecularFormulaByMoiety @<String>?;  # Specified per moiety according to 
                                            # the Hill system 
    fhir:molecularWeight @<SubstanceDefinition.molecularWeight>?;  # The molecular weight or weight 
                                            # range 
    fhir:technique @<OneOrMore_CodeableConcept>?;  # The method used to find the 
                                            # structure e.g. X-ray, NMR 
    fhir:sourceDocument @<OneOrMore_Reference_DocumentReference>?;  # Source of information for the 
                                            # structure 
    fhir:representation @<OneOrMore_SubstanceDefinition.structure.representation>?;  # A depiction of the structure of 
                                            # the substance 
}  

# A depiction of the structure of the substance
<SubstanceDefinition.structure.representation> EXTENDS @<BackboneElement> CLOSED {   
    fhir:type @<CodeableConcept>?;          # The kind of structural 
                                            # representation (e.g. full, 
                                            # partial) 
    fhir:representation @<String>?;         # The structural representation as a 
                                            # text string in a standard format 
    fhir:format @<CodeableConcept>?;        # The format of the representation 
                                            # e.g. InChI, SMILES, MOLFILE (note: 
                                            # not the physical file format) 
    fhir:document @<Reference> AND {fhir:l 
    			@<DocumentReference> ? }?;  # An attachment with the structural 
                                            # representation e.g. a structure 
                                            # graphic or AnIML file 
}  

# Codes associated with the substance
<SubstanceDefinition.code> EXTENDS @<BackboneElement> CLOSED {   
    fhir:code @<CodeableConcept>?;          # The specific code
    fhir:status @<CodeableConcept>?;        # Status of the code assignment, for 
                                            # example 'provisional', 'approved' 
    fhir:statusDate @<DateTime>?;           # The date at which the code status 
                                            # was changed 
    fhir:note @<OneOrMore_Annotation>?;     # Any comment can be provided in 
                                            # this field 
    fhir:source @<OneOrMore_Reference_DocumentReference>?;  # Supporting literature
}  

# Names applicable to this substance
<SubstanceDefinition.name> EXTENDS @<BackboneElement> CLOSED {   
    fhir:name @<String>;                    # The actual name
    fhir:type @<CodeableConcept>?;          # Name type e.g. 'systematic',  
                                            # 'scientific, 'brand' 
    fhir:status @<CodeableConcept>?;        # The status of the name e.g. 
                                            # 'current', 'proposed' 
    fhir:preferred @<Boolean>?;             # If this is the preferred name for 
                                            # this substance 
    fhir:language @<OneOrMore_CodeableConcept>?;  # Human language that the name is 
                                            # written in 
    fhir:domain @<OneOrMore_CodeableConcept>?;  # The use context of this name e.g. 
                                            # as an active ingredient or as a 
                                            # food colour additive 
    fhir:jurisdiction @<OneOrMore_CodeableConcept>?;  # The jurisdiction where this name 
                                            # applies 
    fhir:synonym @<OneOrMore_SubstanceDefinition.name>?;  # A synonym of this particular name, 
                                            # by which the substance is also 
                                            # known 
    fhir:translation @<OneOrMore_SubstanceDefinition.name>?;  # A translation for this name into 
                                            # another human language 
    fhir:official @<OneOrMore_SubstanceDefinition.name.official>?;  # Details of the official nature of 
                                            # this name 
    fhir:source @<OneOrMore_Reference_DocumentReference>?;  # Supporting literature
}  

# A synonym of this particular name, by which the substance is also known
<SubstanceDefinition.name.synonymnull> CLOSED {   
}  

# A translation for this name into another human language
<SubstanceDefinition.name.translationnull> CLOSED {   
}  

# Details of the official nature of this name
<SubstanceDefinition.name.official> EXTENDS @<BackboneElement> CLOSED {   
    fhir:authority @<CodeableConcept>?;     # Which authority uses this official 
                                            # name 
    fhir:status @<CodeableConcept>?;        # The status of the official name, 
                                            # for example 'draft', 'active' 
    fhir:date @<DateTime>?;                 # Date of official name change
}  

# A link between this substance and another
<SubstanceDefinition.relationship> EXTENDS @<BackboneElement> CLOSED {   
    fhir:substanceDefinition (@<Reference>  AND {fhir:l @<SubstanceDefinition> })  OR 
    			@<CodeableConcept>  ?;  # A pointer to another substance, as 
                                            # a resource or a representational 
                                            # code 
    fhir:type @<CodeableConcept>;           # For example "salt to parent", 
                                            # "active moiety" 
    fhir:isDefining @<Boolean>?;            # For example where an enzyme 
                                            # strongly bonds with a particular 
                                            # substance, this is a defining 
                                            # relationship for that enzyme, out 
                                            # of several possible relationships 
    fhir:amount @<Quantity>  OR 
    			@<Ratio>  OR 
    			@<String>  OR 
    			@<Range>  ?;  # A numeric factor for the 
                                            # relationship, e.g. that a 
                                            # substance salt has some percentage 
                                            # of active substance in relation to 
                                            # some other 
    fhir:ratioHighLimitAmount @<Ratio>?;    # For use when the numeric has an 
                                            # uncertain range 
    fhir:comparator @<CodeableConcept>?;    # An operator for the amount, for 
                                            # example "average", 
                                            # "approximately", "less than" 
    fhir:measurementType @<CodeableConcept>?;  # The kind of measurement the amount 
                                            # represents (e.g. IC50, Kd, Ki, 
                                            # mole ratio) 
    fhir:interaction @<CodeableConcept>?;   # For target relationships, the kind 
                                            # of interaction (e.g. binding, 
                                            # inhibition, agonism) 
    fhir:organism @<CodeableConcept>?;      # For anti-infective target 
                                            # relationships, the specific 
                                            # organism targeted 
    fhir:organismType @<CodeableConcept>?;  # For anti-infective target 
                                            # relationships, the high-level type 
                                            # of organism targeted 
    fhir:source @<OneOrMore_Reference_DocumentReference>?;  # Supporting literature
}  

# Material or taxonomic/anatomical source
<SubstanceDefinition.sourceMaterial> EXTENDS @<BackboneElement> CLOSED {   
    fhir:type @<CodeableConcept>?;          # Classification of the origin of 
                                            # the raw material. e.g. cat hair is 
                                            # an Animal source type 
    fhir:genus @<CodeableConcept>?;         # The genus of an organism e.g. the 
                                            # Latin epithet of the plant/animal 
                                            # scientific name 
    fhir:species @<CodeableConcept>?;       # The species of an organism e.g. 
                                            # the Latin epithet of the species 
                                            # of the plant/animal 
    fhir:part @<CodeableConcept>?;          # An anatomical origin of the source 
                                            # material within an organism 
    fhir:countryOfOrigin @<OneOrMore_CodeableConcept>?;  # The country or countries where the 
                                            # material is harvested 
}  

# Data items specific to nucleic acids
<SubstanceDefinition.nucleicAcid> EXTENDS @<BackboneElement> CLOSED {   
    fhir:sequenceType @<CodeableConcept>?;  # The type of the sequence (e.g. 
                                            # DNA, RNA) 
    fhir:numberOfSubunits @<Integer>?;      # The number of subunits — strands 
                                            # of nucleic acid that are tightly 
                                            # associated typically through 
                                            # Watson-Crick base pairing 
    fhir:areaOfHybridisation @<String>?;    # The area of hybridisation, for 
                                            # double-stranded RNA or DNA. 
                                            # Expressed as the subunit number 
                                            # followed by the residue number, in 
                                            # increasing order 
    fhir:oligoNucleotideType @<CodeableConcept>?;  # Type or class of the 
                                            # oligonucleotide 
    fhir:subunit @<OneOrMore_SubstanceDefinition.nucleicAcid.subunit>?;  # A subunit constituting the nucleic 
                                            # acid 
    fhir:gene @<OneOrMore_SubstanceDefinition.nucleicAcid.gene>?;  # The gene that codes for this 
                                            # substance 
    fhir:geneElement @<OneOrMore_SubstanceDefinition.nucleicAcid.geneElement>?;  # Gene elements that comprise a 
                                            # nucleic acid construct (used for 
                                            # gene therapy) 
}  

# A subunit constituting the nucleic acid
<SubstanceDefinition.nucleicAcid.subunit> EXTENDS @<BackboneElement> CLOSED {   
    fhir:subunit @<Integer>?;               # Index of the subunit in decreasing 
                                            # length order 
    fhir:sequence @<String>?;               # The nucleotide sequence in 5’→3’ 
                                            # notation using standard 
                                            # single-letter codes 
    fhir:length @<Integer>?;                # The length of the sequence
    fhir:sequenceAttachment @<Attachment>?;  # The sequence as an attached file
    fhir:fivePrime @<CodeableConcept>?;     # The nucleotide present at the 5’ 
                                            # terminus. Since the sequence is 
                                            # represented 5’→3’, this is the 
                                            # first nucleotide in the sequence 
    fhir:threePrime @<CodeableConcept>?;    # The nucleotide present at the 3’ 
                                            # terminus. Since the sequence is 
                                            # represented 5’→3’, this is the 
                                            # last nucleotide in the sequence 
    fhir:linkage @<OneOrMore_SubstanceDefinition.nucleicAcid.subunit.linkage>?;  # The linkages between sugar 
                                            # residues in the nucleotide 
                                            # sequence 
    fhir:sugar @<OneOrMore_SubstanceDefinition.nucleicAcid.subunit.sugar>?;  # A sugar component of the 
                                            # nucleotide sequence 
}  

# The linkages between sugar residues in the nucleotide sequence
<SubstanceDefinition.nucleicAcid.subunit.linkage> EXTENDS @<BackboneElement> CLOSED {   
    fhir:connectivity @<String>?;           # The chemistry of the linkage
    fhir:substance @<CodeableReference>?;   # The linkage substance, as a code 
                                            # or a reference to its 
                                            # SubstanceDefinition 
    fhir:residueSite @<String>?;            # The residue positions at which 
                                            # this linkage applies, in 5’→3’ 
                                            # direction 
}  

# A sugar component of the nucleotide sequence
<SubstanceDefinition.nucleicAcid.subunit.sugar> EXTENDS @<BackboneElement> CLOSED {   
    fhir:substance @<CodeableReference>?;   # The sugar substance, as a code or 
                                            # a reference to its 
                                            # SubstanceDefinition 
    fhir:residueSite @<String>?;            # The residue positions at which 
                                            # this sugar applies, in 5’→3’ 
                                            # direction 
}  

# The gene that codes for this substance
<SubstanceDefinition.nucleicAcid.gene> EXTENDS @<BackboneElement> CLOSED {   
    fhir:sequenceOrigin @<CodeableConcept>?;  # The species or lineage from which 
                                            # the gene sequence originated 
    fhir:gene @<CodeableReference>?;        # The gene itself, as a code or a 
                                            # reference to a SubstanceDefinition 
    fhir:source @<OneOrMore_Reference_DocumentReference>?;  # Supporting literature for the gene 
                                            # information 
}  

# Gene elements that comprise a nucleic acid construct (used for gene therapy)
<SubstanceDefinition.nucleicAcid.geneElement> EXTENDS @<BackboneElement> CLOSED {   
    fhir:type @<CodeableConcept>?;          # The functional role of the element 
                                            # (e.g. promoter, enhancer, coding 
                                            # sequence) 
    fhir:element @<CodeableReference>?;     # The element itself, as a code or a 
                                            # reference to a SubstanceDefinition 
    fhir:source @<OneOrMore_Reference_DocumentReference>?;  # Supporting literature for the gene 
                                            # element information 
}  

# Data items specific to polymers
<SubstanceDefinition.polymer> EXTENDS @<BackboneElement> CLOSED {   
    fhir:class @<CodeableConcept>?;         # Overall type of the polymer
    fhir:geometry @<CodeableConcept>?;      # Polymer geometry, e.g. linear, 
                                            # branched, cross-linked, network or 
                                            # dendritic 
    fhir:copolymerConnectivity @<OneOrMore_CodeableConcept>?;  # Describes the copolymer sequence 
                                            # type (polymer connectivity) 
    fhir:modification @<String>?;           # A modification applied to the 
                                            # polymer 
    fhir:monomerSet @<OneOrMore_SubstanceDefinition.polymer.monomerSet>?;  # A set of monomers used to build 
                                            # the polymer 
    fhir:repeat @<OneOrMore_SubstanceDefinition.polymer.repeat>?;  # Specifies and quantifies the 
                                            # repeated units and their 
                                            # configuration 
}  

# A set of monomers used to build the polymer
<SubstanceDefinition.polymer.monomerSet> EXTENDS @<BackboneElement> CLOSED {   
    fhir:ratioType @<CodeableConcept>?;     # Captures the type of ratio to the 
                                            # entire polymer, e.g. 
                                            # Monomer/Polymer ratio, SRU/Polymer 
                                            # Ratio 
    fhir:startingMaterial @<OneOrMore_SubstanceDefinition.polymer.monomerSet.startingMaterial>?;  # The starting materials - 
                                            # monomer(s) used in the synthesis 
                                            # of the polymer 
}  

# The starting materials - monomer(s) used in the synthesis of the polymer
<SubstanceDefinition.polymer.monomerSet.startingMaterial> EXTENDS @<BackboneElement> CLOSED {   
    fhir:code @<CodeableReference>?;        # The substance acting as starting 
                                            # material, as a code or a reference 
                                            # to a SubstanceDefinition 
    fhir:category @<CodeableConcept>?;      # Substance high level category, 
                                            # e.g. chemical substance 
    fhir:isDefining @<Boolean>?;            # Whether this starting material is 
                                            # part of what defines the polymer's 
                                            # unique identity 
    fhir:amount @<Quantity>?;               # A percentage
}  

# Specifies and quantifies the repeated units and their configuration
<SubstanceDefinition.polymer.repeat> EXTENDS @<BackboneElement> CLOSED {   
    fhir:averageMolecularFormula @<String>?;  # A representation of an (average) 
                                            # molecular formula from a polymer 
    fhir:repeatUnitAmountType @<CodeableConcept>?;  # How the quantitative amount of 
                                            # Structural Repeat Units is 
                                            # captured (e.g. Exact, Numeric, 
                                            # Average) 
    fhir:repeatUnit @<OneOrMore_SubstanceDefinition.polymer.repeat.repeatUnit>?;  # An SRU - Structural Repeat Unit
}  

# An SRU - Structural Repeat Unit
<SubstanceDefinition.polymer.repeat.repeatUnit> EXTENDS @<BackboneElement> CLOSED {   
    fhir:unit @<String>?;                   # Identification of the structural 
                                            # repeat unit (SRU) 
    fhir:orientation @<CodeableConcept>?;   # The orientation of the 
                                            # polymerisation, e.g. head-tail, 
                                            # head-head, random 
    fhir:amount @<Integer>?;                # Number of repeats of this unit
    fhir:degreeOfPolymerisation @<OneOrMore_SubstanceDefinition.polymer.repeat.repeatUnit.degreeOfPolymerisation>?;  # Applies to homopolymer and block 
                                            # co-polymers where the degree of 
                                            # polymerisation within a block can 
                                            # be described 
    fhir:structuralRepresentation @<OneOrMore_SubstanceDefinition.structure.representation>?;  # A graphical structure for this SRU
}  

# Applies to homopolymer and block co-polymers where the degree of polymerisation within a block can be described
<SubstanceDefinition.polymer.repeat.repeatUnit.degreeOfPolymerisation> EXTENDS @<BackboneElement> CLOSED {   
    fhir:type @<CodeableConcept>?;          # The type of degree of 
                                            # polymerisation, e.g. SRU/Polymer 
                                            # ratio 
    fhir:average @<Integer>?;               # An average amount of polymerisation
    fhir:low @<Integer>?;                   # A low expected limit of the amount
    fhir:high @<Integer>?;                  # A high expected limit of the amount
}  

# Data items specific to proteins
<SubstanceDefinition.protein> EXTENDS @<BackboneElement> CLOSED {   
    fhir:sequenceType @<CodeableConcept>?;  # Whether the sequence is complete 
                                            # or partial 
    fhir:numberOfSubunits @<Integer>?;      # Number of subunits — linear 
                                            # sequences of amino acids linked 
                                            # through peptide bonds 
    fhir:disulfideLinkage @<OneOrMore_String>?;  # Disulphide bond(s) between 
                                            # cysteine residues on the same 
                                            # subunit or across two different 
                                            # subunits. Positions are listed in 
                                            # increasing order of subunit number 
                                            # and intra-subunit position, 
                                            # followed by the amino-acid 
                                            # abbreviations. The positions 
                                            # should contain Cysteine residues 
    fhir:subunit @<OneOrMore_SubstanceDefinition.protein.subunit>?;  # Each subunit constituting the 
                                            # protein. A subunit is a linear 
                                            # sequence of amino acids linked 
                                            # through peptide bonds. Used when 
                                            # the finished protein is a complex 
                                            # of multiple sequences (not for 
                                            # domains within a single sequence). 
                                            # Subunits are listed in order of 
                                            # decreasing length; ties resolved 
                                            # by decreasing molecular weight; 
                                            # identical sequences are repeated 
    fhir:gene @<OneOrMore_SubstanceDefinition.nucleicAcid.gene>?;  # The gene that codes for this 
                                            # substance 
}  

# Each subunit constituting the protein. A subunit is a linear sequence of amino acids linked through peptide bonds. Used when the finished protein is a complex of multiple sequences (not for domains within a single sequence). Subunits are listed in order of decreasing length; ties resolved by decreasing molecular weight; identical sequences are repeated
<SubstanceDefinition.protein.subunit> EXTENDS @<BackboneElement> CLOSED {   
    fhir:subunit @<Integer>?;               # Index of primary sequences of 
                                            # amino acids linked through peptide 
                                            # bonds in order of decreasing 
                                            # length. Sequences of the same 
                                            # length will be ordered by 
                                            # molecular weight. Subunits that 
                                            # have identical sequences will be 
                                            # repeated and have sequential 
                                            # subscripts 
    fhir:sequence @<String>?;               # The amino-acid sequence, listed N- 
                                            # to C-terminal using standard 
                                            # single-letter amino-acid codes. 
                                            # Uppercase denotes L-amino acids, 
                                            # lowercase denotes D-amino acids. 
                                            # Transcribed proteins are described 
                                            # using the translated sequence; for 
                                            # synthetic peptides containing 
                                            # amino acids without a 
                                            # single-letter code, X is used. 
                                            # Modified amino acids are 
                                            # identified by their position in 
                                            # the sequence 
    fhir:length @<Integer>?;                # Length of linear sequences of 
                                            # amino acids contained in the 
                                            # subunit 
    fhir:sequenceAttachment @<Attachment>?;  # The amino-acid sequence as an 
                                            # attached file 
    fhir:nTerminalModification @<CodeableReference>?;  # The modification fragment at the 
                                            # N-terminal of the protein 
    fhir:cTerminalModification @<CodeableReference>?;  # The modification fragment at the 
                                            # C-terminal of the protein 
}  

#---------------------- Cardinality Types (OneOrMore) -------------------
<OneOrMore_Identifier> CLOSED {
    rdf:first @<Identifier>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Identifier> 
}
<OneOrMore_CodeableConcept> CLOSED {
    rdf:first @<CodeableConcept>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_CodeableConcept> 
}
<OneOrMore_Annotation> CLOSED {
    rdf:first @<Annotation>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Annotation> 
}
<OneOrMore_Reference_Organization> CLOSED {
    rdf:first @<Reference> AND {fhir:l 
			@<Organization> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_Organization> 
}
<OneOrMore_SubstanceDefinition.moiety> CLOSED {
    rdf:first @<SubstanceDefinition.moiety>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_SubstanceDefinition.moiety> 
}
<OneOrMore_SubstanceDefinition.characterization> CLOSED {
    rdf:first @<SubstanceDefinition.characterization>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_SubstanceDefinition.characterization> 
}
<OneOrMore_SubstanceDefinition.property> CLOSED {
    rdf:first @<SubstanceDefinition.property>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_SubstanceDefinition.property> 
}
<OneOrMore_SubstanceDefinition.molecularWeight> CLOSED {
    rdf:first @<SubstanceDefinition.molecularWeight>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_SubstanceDefinition.molecularWeight> 
}
<OneOrMore_SubstanceDefinition.code> CLOSED {
    rdf:first @<SubstanceDefinition.code>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_SubstanceDefinition.code> 
}
<OneOrMore_SubstanceDefinition.name> CLOSED {
    rdf:first @<SubstanceDefinition.name>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_SubstanceDefinition.name> 
}
<OneOrMore_SubstanceDefinition.relationship> CLOSED {
    rdf:first @<SubstanceDefinition.relationship>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_SubstanceDefinition.relationship> 
}
<OneOrMore_Attachment> CLOSED {
    rdf:first @<Attachment>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Attachment> 
}
<OneOrMore_Reference_DocumentReference> CLOSED {
    rdf:first @<Reference> AND {fhir:l 
			@<DocumentReference> } ;
    rdf:rest [rdf:nil] OR @<OneOrMore_Reference_DocumentReference> 
}
<OneOrMore_SubstanceDefinition.structure.representation> CLOSED {
    rdf:first @<SubstanceDefinition.structure.representation>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_SubstanceDefinition.structure.representation> 
}
<OneOrMore_SubstanceDefinition.name.official> CLOSED {
    rdf:first @<SubstanceDefinition.name.official>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_SubstanceDefinition.name.official> 
}
<OneOrMore_SubstanceDefinition.nucleicAcid.subunit> CLOSED {
    rdf:first @<SubstanceDefinition.nucleicAcid.subunit>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_SubstanceDefinition.nucleicAcid.subunit> 
}
<OneOrMore_SubstanceDefinition.nucleicAcid.gene> CLOSED {
    rdf:first @<SubstanceDefinition.nucleicAcid.gene>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_SubstanceDefinition.nucleicAcid.gene> 
}
<OneOrMore_SubstanceDefinition.nucleicAcid.geneElement> CLOSED {
    rdf:first @<SubstanceDefinition.nucleicAcid.geneElement>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_SubstanceDefinition.nucleicAcid.geneElement> 
}
<OneOrMore_SubstanceDefinition.nucleicAcid.subunit.linkage> CLOSED {
    rdf:first @<SubstanceDefinition.nucleicAcid.subunit.linkage>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_SubstanceDefinition.nucleicAcid.subunit.linkage> 
}
<OneOrMore_SubstanceDefinition.nucleicAcid.subunit.sugar> CLOSED {
    rdf:first @<SubstanceDefinition.nucleicAcid.subunit.sugar>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_SubstanceDefinition.nucleicAcid.subunit.sugar> 
}
<OneOrMore_SubstanceDefinition.polymer.monomerSet> CLOSED {
    rdf:first @<SubstanceDefinition.polymer.monomerSet>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_SubstanceDefinition.polymer.monomerSet> 
}
<OneOrMore_SubstanceDefinition.polymer.repeat> CLOSED {
    rdf:first @<SubstanceDefinition.polymer.repeat>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_SubstanceDefinition.polymer.repeat> 
}
<OneOrMore_SubstanceDefinition.polymer.monomerSet.startingMaterial> CLOSED {
    rdf:first @<SubstanceDefinition.polymer.monomerSet.startingMaterial>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_SubstanceDefinition.polymer.monomerSet.startingMaterial> 
}
<OneOrMore_SubstanceDefinition.polymer.repeat.repeatUnit> CLOSED {
    rdf:first @<SubstanceDefinition.polymer.repeat.repeatUnit>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_SubstanceDefinition.polymer.repeat.repeatUnit> 
}
<OneOrMore_SubstanceDefinition.polymer.repeat.repeatUnit.degreeOfPolymerisation> CLOSED {
    rdf:first @<SubstanceDefinition.polymer.repeat.repeatUnit.degreeOfPolymerisation>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_SubstanceDefinition.polymer.repeat.repeatUnit.degreeOfPolymerisation> 
}
<OneOrMore_String> CLOSED {
    rdf:first @<String>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_String> 
}
<OneOrMore_SubstanceDefinition.protein.subunit> CLOSED {
    rdf:first @<SubstanceDefinition.protein.subunit>  ;
    rdf:rest [rdf:nil] OR @<OneOrMore_SubstanceDefinition.protein.subunit> 
}

