Skip to content

Commit

Permalink
Move XSD files
Browse files Browse the repository at this point in the history
  • Loading branch information
jswise committed Mar 12, 2021
1 parent db50d0e commit 80df08e
Show file tree
Hide file tree
Showing 10 changed files with 7,747 additions and 13 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.pyc
Binary file modified src/pydiggs/__pycache__/boringlog.cpython-38.pyc
Binary file not shown.
26 changes: 13 additions & 13 deletions src/pydiggs/boringlog.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@ def __init__(self):

def extract_xml(self, input_path):
pydiggs_dir = pathlib.Path(__file__).parents[0]
# xsd = str(pydiggs_dir.joinpath('schema', 'Complete.xsd'))
# schema = xmlschema.XMLSchema(xsd)
xsd = str(pydiggs_dir.joinpath('schema', 'Complete.xsd'))
schema = xmlschema.XMLSchema(xsd)
# xml_data = schema.to_dict('tests/test_cases/examples/collection/collection.xml')
# self.log_data['boring_id'] = 'temp'
self.log_data['boring_id'] = 'temp'

namespace = {
'default': 'http://diggsml.org/schemas/2.5.a',
'gml': 'http://www.opengis.net/gml/3.2'
}
tree = ET.parse(input_path)
root = tree.getroot()
first_feature = root.find('default:samplingFeature', namespace)
borehole = first_feature.find('default:Borehole', namespace)
name = borehole.find('gml:name', namespace)
self.log_data['boring_id'] = name.text
# namespace = {
# 'default': 'http://diggsml.org/schemas/2.5.a',
# 'gml': 'http://www.opengis.net/gml/3.2'
# }
# tree = ET.parse(input_path)
# root = tree.getroot()
# first_feature = root.find('default:samplingFeature', namespace)
# borehole = first_feature.find('default:Borehole', namespace)
# name = borehole.find('gml:name', namespace)
# self.log_data['boring_id'] = name.text

def to_pdf(self, output_path):
# output_text = '<p>Pretend this is a boring log.</p>'
Expand Down
75 changes: 75 additions & 0 deletions src/pydiggs/schema/Dictionary_diggs.xsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns:diggs="http://diggsml.org/schemas/2.5.a"
xmlns:diggs_geo="http://diggsml.org/schemas/2.5.a/geotechnical"
xmlns:g3.3="http://www.opengis.net/gml/3.3/ce" xmlns:glr="http://www.opengis.net/gml/3.3/lr"
xmlns:glrov="http://www.opengis.net/gml/3.3/lrov"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:witsml="http://www.witsml.org/schemas/131"
xmlns:gml="http://www.opengis.net/gml/3.2"
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
targetNamespace="http://diggsml.org/schemas/2.5.a" version="2.5.a"
elementFormDefault="qualified" vc:maxVersion="1.1" vc:minVersion="1.0">
<!--
import the gml and xlinks namespaces (original local profiles)
-->
<include schemaLocation="Kernel.xsd"/>
<import namespace="http://www.opengis.net/gml/3.2" schemaLocation="gml3.2Profile_diggs.xsd"/>
<import namespace="http://www.w3.org/1999/xlink" schemaLocation="xlinks.xsd"/>
<import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="xml.xsd"/>
<element name="Definition" substitutionGroup="gml:AbstractGML" abstract="false"
type="diggs:DefinitionType"> </element>
<complexType name="DefinitionType">
<complexContent>
<extension base="gml:DefinitionType">
<sequence>
<element minOccurs="0" name="dataType" type="diggs:PropertyDataTypeEnumType">
<annotation>
<documentation>The data type of the property, eg. integer, string, etc. From an enumerated list</documentation>
</annotation>
</element>
<element minOccurs="0" name="uomType" type="diggs:PropertyUomTypeEnumType">
<annotation>
<documentation>The type or classification of the unit of measure for properties that have numeric values. From an enumerated list.</documentation>
</annotation>
</element>
<element minOccurs="0" name="authority" type="string">
<annotation>
<documentation>Name of the organization or authority that controls the term</documentation>
</annotation>
</element>
<element maxOccurs="unbounded" minOccurs="0" name="associatedElement"
type="string">
<annotation>
<documentation>The XPATH of the Diggs element for which this code/property applies, eg. for the lithology classification code: /diggs:Diggs/diggs:observation/diggs:LithologySystem/diggs:lithologyObservation/diggs:LithologyObservation/diggs:primaryLithology/diggs:Lithology/diggs:classificationCode. Since a code value may apply to several DIGGS elements, multiple associatedElements are allowed.</documentation>
</annotation>
</element>
</sequence>
</extension>
</complexContent>
</complexType>
<element name="Dictionary" type="diggs:DictionaryType" substitutionGroup="diggs:Definition"/>
<complexType name="DictionaryEntryBaseType">
<complexContent>
<restriction base="gml:DictionaryEntryType"/>
</complexContent>
</complexType>
<complexType name="DictionaryEntryType">
<complexContent>
<extension base="gml:AbstractMemberType">
<sequence minOccurs="0">
<element ref="diggs:Definition"/>
</sequence>
<attributeGroup ref="gml:AssociationAttributeGroup"/>
</extension>
</complexContent>
</complexType>
<complexType name="DictionaryType">
<complexContent>
<extension base="diggs:DefinitionType">
<choice maxOccurs="unbounded" minOccurs="0">
<element name="dictionaryEntry" type="diggs:DictionaryEntryType"/>
</choice>
</extension>
</complexContent>
</complexType>
</schema>
Loading

0 comments on commit 80df08e

Please sign in to comment.