<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:cit="http://standards.iso.org/iso/19115/-3/cit/1.0" xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:gsmlb="http://xmlns.geosciml.org/GeoSciML-Basic/4.0" xmlns:gmlexr="http://www.opengis.net/gml/3.3/exr" xmlns:gsmlbh="http://xmlns.geosciml.org/Borehole/4.0" xmlns:sf="http://www.opengis.net/samplingSpatial/2.0" xmlns:swe="http://www.opengis.net/swe/2.0" targetNamespace="http://xmlns.geosciml.org/Borehole/4.0" elementFormDefault="qualified" version="4.0.0">
	<annotation>
		<documentation>The GeoSciML Borehole package contains model elements for representing Boreholes. This is primarily through re-use of standard components from the (external) Observations and Measurements package.</documentation>
	</annotation>
<!-- namespace for cit added manually, does not fit the one declared in the UML model -->
	<import namespace="http://standards.iso.org/iso/19115/-3/cit/1.0" schemaLocation="http://standards.iso.org/iso/19115/-3/cit/1.0/cit.xsd"/>
	<import namespace="http://www.opengis.net/gml/3.2" schemaLocation="http://schemas.opengis.net/gml/3.2.1/gml.xsd"/>
	<import namespace="http://www.opengis.net/gml/3.3/exr" schemaLocation="http://schemas.opengis.net/gml/3.3/extdEncRule.xsd"/>
  <import namespace="http://www.opengis.net/samplingSpatial/2.0" schemaLocation="http://schemas.opengis.net/samplingSpatial/2.0/spatialSamplingFeature.xsd"/>
	<import namespace="http://www.opengis.net/swe/2.0" schemaLocation="http://schemas.opengis.net/sweCommon/2.0/swe.xsd"/>
	<!--XML Schema document created by ShapeChange - http://shapechange.net/-->
  <element name="Borehole" substitutionGroup="sf:SF_SpatialSamplingFeature" type="gsmlbh:BoreholeType">
		<annotation>
			<documentation>A borehole is the generalized term for any narrow shaft drilled in the ground, either vertically, horizontally, or inclined.</documentation>
		</annotation>
	</element>
	<complexType name="BoreholeType">
		<complexContent>
			<extension base="sf:SF_SpatialSamplingFeatureType">
				<sequence>
          <element minOccurs="0" name="referenceLocation" nillable="true" type="gsmlbh:OriginPositionPropertyType">
						<annotation>
							<documentation>A Borehole OriginPosition is a feature corresponding to the start point of a borehole log.  This may, but not necessarily, correspond to the borehole collar location (eg, kelly bush).</documentation>
							<appinfo>
								<reversePropertyName xmlns="http://www.opengis.net/gml/3.2">gsmlbh:relatedBorehole</reversePropertyName>
							</appinfo>
						</annotation>
					</element>
          <element minOccurs="0" name="indexData" nillable="true">
						<annotation>
							<documentation>Specifies the Borehole details</documentation>
						</annotation>
            <complexType>
              <sequence>
                <element ref="gsmlbh:BoreholeDetails"/>
              </sequence>
              <attribute name="nilReason" type="gml:NilReasonType"/>
            </complexType>
					</element>
          <element maxOccurs="unbounded" minOccurs="0" name="downholeDrillingDetails" nillable="true">
						<annotation>
							<documentation>Specifies the drilling method and borehole diameter for intervals down the borehole</documentation>
						</annotation>
            <complexType>
              <sequence>
                <element ref="gsmlbh:DrillingDetails"/>
              </sequence>
              <attribute name="nilReason" type="gml:NilReasonType"/>
            </complexType>
					</element>
          <element maxOccurs="unbounded" minOccurs="0" name="logElement" nillable="true" type="gsmlbh:BoreholeIntervalPropertyType">
						<annotation>
							<documentation>Links to 1-D MappedFeature instances that are logged (interpreted) intervals within a borehole. This requirement is common in geoscience boreholes</documentation>
							<appinfo>
								<reversePropertyName xmlns="http://www.opengis.net/gml/3.2">gsmlbh:parentBorehole</reversePropertyName>
							</appinfo>
						</annotation>
					</element>
				</sequence>
			</extension>
		</complexContent>
	</complexType>
	<complexType name="BoreholePropertyType">
		<sequence minOccurs="0">
			<element ref="gsmlbh:Borehole"/>
		</sequence>
		<attributeGroup ref="gml:AssociationAttributeGroup"/>
		<attributeGroup ref="gml:OwnershipAttributeGroup"/>
	</complexType>
  <element name="BoreholeDetails" substitutionGroup="gml:AbstractObject" type="gsmlbh:BoreholeDetailsType">
		<annotation>
			<documentation>Borehole-specific index or header information. This data does not relate to downhole intervals.</documentation>
		</annotation>
	</element>
	<complexType name="BoreholeDetailsType">
		<sequence>
      <element minOccurs="0" name="operator" nillable="true" type="cit:CI_Responsibility_PropertyType">
				<annotation>
					<documentation>Organisation responsible for commissioning the borehole (as opposed to drilling the borehole)</documentation>
				</annotation>
			</element>
      <element minOccurs="0" name="driller" nillable="true" type="cit:CI_Responsibility_PropertyType">
				<annotation>
					<documentation>The organisation responsible for drilling the borehole (as opposed to commissioning the borehole)</documentation>
				</annotation>
			</element>
      <element minOccurs="0" name="dateOfDrilling" nillable="true" type="gml:TimePeriodPropertyType">
				<annotation>
					<documentation>The time period during which drilling of the borehole occurred.</documentation>
				</annotation>
			</element>
      <element minOccurs="0" name="startPoint" nillable="true" type="gml:ReferenceType">
				<annotation>
					<documentation>Indicates the position relative to ground surface where the borehole commenced. Appropriate terms would include Drilled from Ground Surface; Drilled Underground;  Drilled from Quarry Floor etc</documentation>
					<appinfo>
						<targetElement xmlns="http://www.opengis.net/gml/3.2">gsmlbh:BoreholeStartPointCode</targetElement>
						<targetCodeList xmlns="http://www.opengis.net/gml/3.3/exr">BoreholeStartPointCode</targetCodeList>
					</appinfo>
				</annotation>
			</element>
      <element minOccurs="0" name="inclinationType" nillable="true" type="gml:ReferenceType">
				<annotation>
					<documentation>Indicates the inclination of the borehole. Appropriate terms would include vertical; inclined up; inclined down, horizontal</documentation>
					<appinfo>
						<targetElement xmlns="http://www.opengis.net/gml/3.2">gsmlbh:BoreholeInclinationCode</targetElement>
						<targetCodeList xmlns="http://www.opengis.net/gml/3.3/exr">BoreholeInclinationCode</targetCodeList>
					</appinfo>
				</annotation>
			</element>
      <element maxOccurs="unbounded" minOccurs="0" name="boreholeMaterialCustodian" nillable="true" type="cit:CI_Responsibility_PropertyType">
				<annotation>
					<documentation>Organisation that is custodian of the core recovered from the borehole</documentation>
				</annotation>
			</element>
      <element maxOccurs="unbounded" minOccurs="0" name="purpose" nillable="true" type="gml:ReferenceType">
				<annotation>
					<documentation>The purpose for which the borehole was drilled. eg, site investigation, mineral exploration, hydrocarbon exploration, water resources</documentation>
					<appinfo>
						<targetElement xmlns="http://www.opengis.net/gml/3.2">gsmlbh:BoreholePurposeCode</targetElement>
						<targetCodeList xmlns="http://www.opengis.net/gml/3.3/exr">BoreholePurposeCode</targetCodeList>
					</appinfo>
				</annotation>
			</element>
      <element maxOccurs="unbounded" minOccurs="0" name="dataCustodian" nillable="true" type="cit:CI_Responsibility_PropertyType">
				<annotation>
					<documentation>The custodian (person or organisation) that is the custodian of data pertaining to this borehole.</documentation>
				</annotation>
			</element>
      <element minOccurs="0" name="boreholeLength" nillable="true">
				<annotation>
					<documentation>The "length" of a borehole will be determined by the data provider (ie, "length" can have different sources, like drillers measurement, loggers measurement, survey measurement, etc)</documentation>
				</annotation>
				<complexType>
					<complexContent>
						<extension base="gml:AbstractMemberType">
							<sequence minOccurs="0">
								<element ref="swe:Quantity"/>
							</sequence>
							<attributeGroup ref="gml:AssociationAttributeGroup"/>
						</extension>
					</complexContent>
				</complexType>
			</element>
		</sequence>
	</complexType>
	<complexType name="BoreholeDetailsPropertyType">
		<sequence>
			<element ref="gsmlbh:BoreholeDetails"/>
		</sequence>
	</complexType>
  <element name="BoreholeInterval" substitutionGroup="gml:AbstractFeature" type="gsmlbh:BoreholeIntervalType">
		<annotation>
			<documentation>A special kind of Mapped Feature whose shape is 1-D interval and uses the SRS of the containing borehole</documentation>
		</annotation>
	</element>
	<complexType name="BoreholeIntervalType">
		<complexContent>
			<extension base="gml:AbstractFeatureType">
				<sequence>
          <element maxOccurs="unbounded" minOccurs="0" name="observationMethod" nillable="true">
            <annotation>
              <documentation>The method used to observe the properties of the borehole</documentation>
            </annotation>
						<complexType>
							<complexContent>
								<extension base="gml:AbstractMemberType">
									<sequence minOccurs="0">
										<element ref="swe:Category"/>
									</sequence>
									<attributeGroup ref="gml:AssociationAttributeGroup"/>
								</extension>
							</complexContent>
						</complexType>
					</element>
          <element minOccurs="0" name="specification" nillable="true" type="gml:FeaturePropertyType">
						<annotation>
              <documentation>The domain feature that is sampled by the interval (eg, a GeologicUnit). Equaivalent to O&amp;M "sampledFeature".</documentation>
						</annotation>
					</element>
          <element minOccurs="0" name="mappedIntervalBegin" nillable="true">
            <annotation>
              <documentation>The measured distance of the start of the mapped interval along the path of the borehole. The measured value must be less than or equal to the mappedIntervalEnd value.  The "mappedIntervalBegin" and "mappedIntervalEnd" elements are included here as a measure to overcome problems with the delivery and queryability of 1D GML shapes via the "shape" property.</documentation>
            </annotation>
						<complexType>
							<complexContent>
								<extension base="gml:AbstractMemberType">
									<sequence minOccurs="0">
										<element ref="swe:Quantity"/>
									</sequence>
									<attributeGroup ref="gml:AssociationAttributeGroup"/>
								</extension>
							</complexContent>
						</complexType>
					</element>
          <element minOccurs="0" name="mappedIntervalEnd" nillable="true">
            <annotation>
              <documentation>The measured distance of the start of the mapped interval along the path of the borehole. The measured value must be less than or equal to the mappedIntervalEnd value.  The "mappedIntervalBegin" and "mappedIntervalEnd" elements are included here as a measure to overcome problems with the delivery and queryability of 1D GML shapes via the "shape" property.</documentation>
            </annotation>
						<complexType>
							<complexContent>
								<extension base="gml:AbstractMemberType">
									<sequence minOccurs="0">
										<element ref="swe:Quantity"/>
									</sequence>
									<attributeGroup ref="gml:AssociationAttributeGroup"/>
								</extension>
							</complexContent>
						</complexType>
					</element>
          <element minOccurs="0" name="collectionIdentifier" nillable="true">
            <annotation>
              <documentation>A property to group BoreholeIntervals in order to implement multiple logs on a single borehole. GenericName should identify a particular log observation event.</documentation>
            </annotation>
            <complexType>
              <simpleContent>
                <extension base="gml:CodeWithAuthorityType">
                  <attribute name="nilReason" type="gml:NilReasonType"/>
                </extension>
              </simpleContent>
            </complexType>
          </element>
          <element minOccurs="0" name="shape" nillable="true" type="gml:GeometryPropertyType">
            <annotation>
              <documentation>Geometry of the interval</documentation>
            </annotation>
					</element>
          <element minOccurs="0" name="parentBorehole" nillable="true" type="gsmlbh:BoreholePropertyType">
						<annotation>
              <documentation>The borehole in which the interval occurs.</documentation>
							<appinfo>
								<reversePropertyName xmlns="http://www.opengis.net/gml/3.2">gsmlbh:logElement</reversePropertyName>
							</appinfo>
						</annotation>
					</element>
				</sequence>
			</extension>
		</complexContent>
	</complexType>
	<complexType name="BoreholeIntervalPropertyType">
		<sequence minOccurs="0">
			<element ref="gsmlbh:BoreholeInterval"/>
		</sequence>
		<attributeGroup ref="gml:AssociationAttributeGroup"/>
		<attributeGroup ref="gml:OwnershipAttributeGroup"/>
	</complexType>
  <element name="DrillingDetails" substitutionGroup="gml:AbstractObject" type="gsmlbh:DrillingDetailsType">
    <annotation>
      <documentation>A class to capture description of drilling methods and hole diameter down the hole.</documentation>
    </annotation>
  </element>
	<complexType name="DrillingDetailsType">
		<sequence>
      <element minOccurs="0" name="drillingMethod" nillable="true" type="gml:ReferenceType">
				<annotation>
          <documentation>Indicates the drilling method used. Appropriate terms would include rotary air blast; auger; diamond core; air core; etc</documentation>
					<appinfo>
						<targetElement xmlns="http://www.opengis.net/gml/3.2">gsmlbh:BoreholeDrillingMethodCode</targetElement>
						<targetCodeList xmlns="http://www.opengis.net/gml/3.3/exr">BoreholeDrillingMethodCode</targetCodeList>
					</appinfo>
				</annotation>
			</element>
      <element minOccurs="0" name="boreholeDiameter" nillable="true">
        <annotation>
          <documentation>The diameter of the drilled hole.</documentation>
        </annotation>
				<complexType>
					<complexContent>
						<extension base="gml:AbstractMemberType">
							<sequence minOccurs="0">
								<element ref="swe:Quantity"/>
							</sequence>
							<attributeGroup ref="gml:AssociationAttributeGroup"/>
						</extension>
					</complexContent>
				</complexType>
			</element>
      <element minOccurs="0" name="interval" type="gml:GeometryPropertyType">
        <annotation>
          <documentation>A shape that is a 1-D interval (eg, a "from" and "to", or "top" and "base" measurement) and uses the SRS of the containing borehole.</documentation>
        </annotation>
      </element>
      <element minOccurs="0" name="intervalBegin" nillable="true">
        <annotation>
          <documentation>The measured distance of the start of the interval along the path of the borehole. The measured value must be less than or equal to the IntervalEnd value.  The "IntervalBegin" and "IntervalEnd" elements are added in version 3.2 as a measure to overcome problems with the delivery and queryability of 1D GML shapes via the "shape" property.</documentation>
        </annotation>
				<complexType>
					<complexContent>
						<extension base="gml:AbstractMemberType">
							<sequence minOccurs="0">
								<element ref="swe:Quantity"/>
							</sequence>
							<attributeGroup ref="gml:AssociationAttributeGroup"/>
						</extension>
					</complexContent>
				</complexType>
			</element>
      <element minOccurs="0" name="intervalEnd" nillable="true">
        <annotation>
          <documentation>The measured distance of the end of the interval along the path of the borehole. The measured value must be greater than or equal to the IntervalBegin value.  The "IntervalBegin" and "IntervalEnd" elements are added in version 3.2 as a measure to overcome problems with the delivery and queryability of 1D GML shapes via the "shape" property.</documentation>
        </annotation>
				<complexType>
					<complexContent>
						<extension base="gml:AbstractMemberType">
							<sequence minOccurs="0">
								<element ref="swe:Quantity"/>
							</sequence>
							<attributeGroup ref="gml:AssociationAttributeGroup"/>
						</extension>
					</complexContent>
				</complexType>
			</element>
		</sequence>
	</complexType>
	<complexType name="DrillingDetailsPropertyType">
		<sequence>
			<element ref="gsmlbh:DrillingDetails"/>
		</sequence>
	</complexType>
  <element name="OriginPosition" substitutionGroup="gml:AbstractFeature" type="gsmlbh:OriginPositionType">
		<annotation>
			<documentation>A Borehole OriginPosition is a feature corresponding to the start point of a borehole log.  This may, but not necessarily, correspond to the borehole collar location (eg, kelly bush).

If a text descripiton of the location is available, it should be placed in the gml:description for that feature.  If no GM_Point is available, an OGC nil value should be used.

Implementers delivering 3-D origin locations should provide an elevation to improve interoperability. 

In situations where the origin position changes over the life of the borehole (eg, due to subsidence or destruction of the original collar), the origin position should be updated to the new location.</documentation>
		</annotation>
	</element>
	<complexType name="OriginPositionType">
		<complexContent>
			<extension base="gml:AbstractFeatureType">
				<sequence>
          <element minOccurs="0" name="location" type="gml:PointPropertyType">
						<annotation>
              <documentation>The location of the borehole collar.</documentation>
						</annotation>
					</element>
          <element minOccurs="0" name="elevation" type="gml:DirectPositionType">
						<annotation>
							<documentation>Compromise approach to supply elevation explictly for location; this is to allow for software that cannot process 3-D GM_Point. Use null if elevation is unknown. Direct position shall have a dimension of 1, and CRS will be a "vertical" CRS (e.g. EPSG CRSs in the range 5600-5799).</documentation>
						</annotation>
					</element>
          <element maxOccurs="unbounded" minOccurs="0" name="relatedBorehole" type="gsmlbh:BoreholePropertyType">
						<annotation>
							<documentation>The hole that has this collar for its start point</documentation>
							<appinfo>
								<reversePropertyName xmlns="http://www.opengis.net/gml/3.2">gsmlbh:referenceLocation</reversePropertyName>
							</appinfo>
						</annotation>
					</element>
				</sequence>
			</extension>
		</complexContent>
	</complexType>
	<complexType name="OriginPositionPropertyType">
		<sequence minOccurs="0">
			<element ref="gsmlbh:OriginPosition"/>
		</sequence>
		<attributeGroup ref="gml:AssociationAttributeGroup"/>
		<attributeGroup ref="gml:OwnershipAttributeGroup"/>
	</complexType>
</schema>
