Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metadata structures and sets to IM and SDMX-ML reader #152

Merged
merged 103 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
48837c3
BaseDataflow.structure inherits is_external_reference
khaeru Dec 27, 2023
d82366c
Mark 4 sources as not supporting actualconstraint
khaeru Dec 27, 2023
5abf000
Add args for tests of actualconstraint from 4 sources
khaeru Dec 27, 2023
2202a16
Improve .reader.xml.v21._ms_component()
khaeru Dec 27, 2023
8767018
Pop TimeRangeValue subclasses when parsing <com:KeyValue>
khaeru Dec 27, 2023
224edc6
Remove blanket Xfail of actualconstraint queries
khaeru Dec 27, 2023
67863da
Handle RangePeriod in .writer.pandas
khaeru Dec 27, 2023
262a42b
Ensure ProvisionAgreement is hashable
khaeru Dec 27, 2023
6d6af21
Parse <str:ProvisionAgreement> as reference
khaeru Dec 27, 2023
6944b3f
Handle != 1 constrained objects in _ms_component()
khaeru Dec 27, 2023
8fb3c61
Use str(response) not repr() in Message.__repr__()
khaeru Dec 27, 2023
aae7736
Update sources.json per {allowed,content}constraint
khaeru Dec 27, 2023
46262db
Remove blanket Xfail of {allowed,content}constraint queries
khaeru Dec 27, 2023
a221f3a
Update sources.json per structureset support
khaeru Dec 27, 2023
34f8fed
Add StructureMessage.structureset
khaeru Dec 28, 2023
c95eec1
Bump mypy to 1.8.0; ruff to 0.1.9
khaeru Dec 28, 2023
f49a575
Add StructureSet, ItemSchemeMap, ItemAssociation IM classes
khaeru Dec 28, 2023
474b9d2
Add StructureSet, CodelistMap, CodeMap to .format.xml
khaeru Dec 28, 2023
b042f95
Simplify .reader.xml.v21 using @possible_reference()
khaeru Dec 28, 2023
f4fe4aa
Use multi-line strings consistently in .reader.xml
khaeru Dec 28, 2023
4a72a5e
Remove blanket Xfail of structure{,set} queries
khaeru Dec 28, 2023
c53cf9f
Parse StructureSet, CodelistMap, CodeMap from XML
khaeru Dec 28, 2023
2b8017d
Add actualconstraint, structureset specimens
khaeru Dec 28, 2023
6876e3d
Add 2.1/3.0 IM classes HierarchicalCode, Level
khaeru Dec 28, 2023
6ff2a70
Add 2.1 IM classes Hierarchy, HierarchicalCodelist
khaeru Dec 28, 2023
c151300
Add Hierarchy classes to .format.xml
khaeru Dec 28, 2023
bac2268
Parse str:HierarchicalCodelist etc. from v2.1 XML
khaeru Dec 28, 2023
833cf9b
Add StructureMessage.hierarchical_code_list
khaeru Dec 28, 2023
716e0f1
Test .model.v21.HierarchicalCodelist
khaeru Dec 28, 2023
e68330c
Update sources.json per hierarchicalcodelist support
khaeru Dec 28, 2023
9ca7565
Add 3 specimens of v2.1 HierarchicalCodelist
khaeru Dec 28, 2023
10a451c
Remove blanket Xfail of hierarchicalcodelist queries
khaeru Dec 28, 2023
ad2dfd7
Consolidate common CodingFormat, Level
khaeru Dec 28, 2023
94ad346
Add v30.Hierarchy to .format.xml
khaeru Dec 28, 2023
aefbbee
Add StructureMessage.hierarchy
khaeru Dec 28, 2023
ba2561b
Test read of bool Hierarchy.has_formal_levels
khaeru Dec 28, 2023
7e08b58
Use versioned Reference to parse HierarchicalCode
khaeru Dec 28, 2023
1ba97ec
Read SDMX-ML 3.0.0 <str:Hierarchy>
khaeru Dec 28, 2023
5090a1e
Add 3 specimens of v3 Hierarchy
khaeru Dec 28, 2023
c334c12
Update test_model.test_common
khaeru Dec 28, 2023
71d89a5
Update sources.json per metadatastructure query support
khaeru Dec 28, 2023
09de1c4
Add partial implementations of some IM §7 classes
khaeru Dec 29, 2023
982d084
Add StructureMessage.metadatastructure
khaeru Dec 29, 2023
b2823bf
Improve common.Structure, v21.MetadataStructureDefinition
khaeru Dec 29, 2023
ece0051
Ensure .v30.MetadataStructureDefinition is hashable
khaeru Dec 29, 2023
2213e62
Update .model.v30 ClassFinder
khaeru Dec 29, 2023
09b681c
Add .v21.ReportStructure.report_for
khaeru Dec 29, 2023
86998d2
Update .format.xml
khaeru Dec 29, 2023
69cb498
Read {Metad,D}ataStructureDefinition with 1 method
khaeru Dec 29, 2023
821d7ab
Extend XML tags handled by .v21._component()
khaeru Dec 29, 2023
165771f
Use Structure.replace_grouping(); handle metadata ComponentLists
khaeru Dec 29, 2023
cc6b191
Read SDMX-ML 3.0 metadata structures
khaeru Dec 29, 2023
98c1b69
Remove blanket Xfail of metadatastructure queries
khaeru Dec 29, 2023
607fc24
Add 5 specimens of SDMX-ML 2.1 and 3.0 metadata structures
khaeru Dec 29, 2023
1f0594e
Update sources.json per metadataflow support
khaeru Dec 30, 2023
ae895e2
Update docstring of Resource class
khaeru Dec 30, 2023
415b44a
Ensure MetadataflowDefinition is a dataclass
khaeru Dec 30, 2023
4ae4655
Add .model.v21.TargetObject{Value,Key}
khaeru Dec 30, 2023
5f7b081
Add ReportedAttribute.__{getitem,len}__()
khaeru Dec 30, 2023
e496239
Add .v21.XHTMLAttributeValue.value
khaeru Dec 30, 2023
cd22574
Add .v21.MetadataReport.attaches_to
khaeru Dec 30, 2023
6e440e1
Add MetadataMessage
khaeru Dec 30, 2023
f11f8de
Add "md" XML namespace for /metadata/generic
khaeru Dec 30, 2023
4e574df
Extend .format.xml
khaeru Dec 30, 2023
1e921a0
BaseMetadataSet attribute values are optional
khaeru Dec 30, 2023
f2da358
Don't parse through XHTML embedded in XML
khaeru Dec 30, 2023
168da3a
Add metadata elements to .xml.v21 parsers
khaeru Dec 30, 2023
dac74ba
Add (Metad,D}ataMessage.structure_type property
khaeru Dec 30, 2023
6db4689
Generalize .v21._header_structure() for data/metadata
khaeru Dec 30, 2023
e46c7bf
Parse <com:StructuredText> as XHTML
khaeru Dec 30, 2023
36c81ba
Check {Metad,D}ataMessage.structure_type in .v21._ref()
khaeru Dec 30, 2023
d4a62b5
Update SDMX_ML_SUPPORTS[Resource.metadata] to True
khaeru Dec 30, 2023
e98a4cf
Parse SDMX-ML 2.1 <mes:MetadataSet> and contents
khaeru Dec 30, 2023
f2abcc4
Update test specimens
khaeru Dec 30, 2023
e916ba8
Add tests of .v21.MetadataSet & parsing
khaeru Dec 30, 2023
dabe7ca
Add {Metad,D}ataStructure to name map
khaeru Dec 30, 2023
ef17250
Instantiate Message to check structure_type in _ref()
khaeru Dec 30, 2023
2c86b2a
Add .model.common.ExtendedFacetValueType
khaeru Jan 4, 2024
9d5d7ca
Allow names without namespace in XMLFormat.qname()
khaeru Jan 4, 2024
8ec58d4
Add ReportPeriodTarget to .format.xml.v21
khaeru Jan 4, 2024
9d85b3d
Xfail read of esms_structured.xml
khaeru Jan 4, 2024
2a3e1d3
Parse value_for ID in structure-specifc <ReferenceValue/>
khaeru Jan 4, 2024
5d50580
Parse ExtendedFacetValueType from XML
khaeru Jan 4, 2024
bc73937
Parse <str:Structure> as DSD ref in StructureMessage
khaeru Jan 4, 2024
c092700
Parse ReportPeriod{,Target} from XML
khaeru Jan 4, 2024
2a820e0
Add test_reader_xml.test_read_xml_ss()
khaeru Jan 4, 2024
c1be38b
Move IM §9 v21-specific classes from .common
khaeru Jan 9, 2024
91e31fa
Add MetadataAttribute.{child,parent}, defaults
khaeru Jan 9, 2024
799d98f
Export enums from .model.common
khaeru Jan 9, 2024
4ef47d0
.v21.MetadataStructureDefinition associates to multiple ReportStructures
khaeru Jan 9, 2024
448cd2b
Label and export newly implemented IM classes
khaeru Jan 9, 2024
f8aa532
Parse generic and ss MetadataSet from v21 and v30 XML
khaeru Jan 9, 2024
7cda033
Un-xfail read of esms_structured.xml
khaeru Jan 9, 2024
5b94ea2
Exclude TYPE_CHECKING blocks from coverage
khaeru Jan 9, 2024
f520d59
Update .format.xml
khaeru Jan 9, 2024
367fef4
Update class lists in .test_model
khaeru Jan 9, 2024
6668c49
Test Structure.grouping, .replace_grouping()
khaeru Jan 10, 2024
85f7f82
Avoid "id" attribute to sort Structure.grouping
khaeru Jan 10, 2024
24234ca
Avoid internal warning in StructureMessage definition
khaeru Jan 10, 2024
8353152
Test Message.__repr__() with requests.Response
khaeru Jan 10, 2024
60cc441
Test HierarchicalCodelist.__repr__()
khaeru Jan 10, 2024
2b51515
Restore coverage in .reader.xml.v21
khaeru Jan 10, 2024
577c7f7
Add #152 to docs, what's new
khaeru Jan 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ __pycache__
.coverage*
.mypy_cache
.pytest_cache
.ruff_cache
build
coverage.xml
dist
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.6.1
rev: v1.8.0
hooks:
- id: mypy
additional_dependencies:
Expand All @@ -15,7 +15,7 @@ repos:
- types-requests
args: []
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.2
rev: v0.1.9
hooks:
- id: ruff
- id: ruff-format
Expand Down
7 changes: 7 additions & 0 deletions doc/api/model-common-list.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.. This file is auto-generated by doc/conf.py.

:obj:`~.common.ActionType`
:obj:`~.common.Agency`
:obj:`~.common.AgencyScheme`
:obj:`~.common.AnnotableArtefact`
Expand All @@ -12,12 +13,14 @@
:obj:`~.common.CategoryScheme`
:obj:`~.common.Code`
:obj:`~.common.Codelist`
:obj:`~.common.CodingFormat`
:obj:`~.common.Component`
:obj:`~.common.ComponentList`
:obj:`~.common.Concept`
:obj:`~.common.ConceptScheme`
:obj:`~.common.ConstrainableArtefact`
:obj:`~.common.ConstraintRole`
:obj:`~.common.ConstraintRoleType`
:obj:`~.common.Contact`
:obj:`~.common.CubeRegion`
:obj:`~.common.CustomType`
Expand All @@ -34,19 +37,23 @@
:obj:`~.common.DimensionDescriptor`
:obj:`~.common.DimensionRelationship`
:obj:`~.common.EndPeriod`
:obj:`~.common.ExtendedFacetValueType`
:obj:`~.common.Facet`
:obj:`~.common.FacetType`
:obj:`~.common.FacetValueType`
:obj:`~.common.FromVTLSpaceKey`
:obj:`~.common.GroupDimensionDescriptor`
:obj:`~.common.GroupKey`
:obj:`~.common.GroupRelationship`
:obj:`~.common.HierarchicalCode`
:obj:`~.common.ISOConceptReference`
:obj:`~.common.IdentifiableArtefact`
:obj:`~.common.InternationalString`
:obj:`~.common.Item`
:obj:`~.common.ItemScheme`
:obj:`~.common.Key`
:obj:`~.common.KeyValue`
:obj:`~.common.Level`
:obj:`~.common.MaintainableArtefact`
:obj:`~.common.MetadataTargetRegion`
:obj:`~.common.NamePersonalisation`
Expand Down
28 changes: 28 additions & 0 deletions doc/api/model-v21-list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,55 @@

:obj:`~.v21.AfterPeriod`
:obj:`~.v21.BeforePeriod`
:obj:`~.v21.CodeMap`
:obj:`~.v21.CodelistMap`
:obj:`~.v21.Constraint`
:obj:`~.v21.ContentConstraint`
:obj:`~.v21.DataKey`
:obj:`~.v21.DataKeySet`
:obj:`~.v21.DataSetTarget`
:obj:`~.v21.DataStructureDefinition`
:obj:`~.v21.DataflowDefinition`
:obj:`~.v21.DimensionDescriptorValuesTarget`
:obj:`~.v21.EnumeratedAttributeValue`
:obj:`~.v21.GenericDataSet`
:obj:`~.v21.GenericTimeSeriesDataSet`
:obj:`~.v21.HierarchicalCodelist`
:obj:`~.v21.Hierarchy`
:obj:`~.v21.IdentifiableObjectTarget`
:obj:`~.v21.ItemAssociation`
:obj:`~.v21.ItemSchemeMap`
:obj:`~.v21.MeasureDescriptor`
:obj:`~.v21.MeasureDimension`
:obj:`~.v21.MemberSelection`
:obj:`~.v21.MemberValue`
:obj:`~.v21.MetadataReport`
:obj:`~.v21.MetadataSet`
:obj:`~.v21.MetadataStructureDefinition`
:obj:`~.v21.MetadataTarget`
:obj:`~.v21.MetadataflowDefinition`
:obj:`~.v21.NoSpecifiedRelationship`
:obj:`~.v21.NonEnumeratedAttributeValue`
:obj:`~.v21.Observation`
:obj:`~.v21.OtherNonEnumeratedAttributeValue`
:obj:`~.v21.PrimaryMeasure`
:obj:`~.v21.PrimaryMeasureRelationship`
:obj:`~.v21.RangePeriod`
:obj:`~.v21.ReportPeriodTarget`
:obj:`~.v21.ReportStructure`
:obj:`~.v21.ReportedAttribute`
:obj:`~.v21.ReportingCategory`
:obj:`~.v21.ReportingTaxonomy`
:obj:`~.v21.ReportingYearStartDay`
:obj:`~.v21.SelectionValue`
:obj:`~.v21.StructureSet`
:obj:`~.v21.StructureSpecificDataSet`
:obj:`~.v21.StructureSpecificTimeSeriesDataSet`
:obj:`~.v21.TargetIdentifiableObject`
:obj:`~.v21.TargetObject`
:obj:`~.v21.TargetObjectKey`
:obj:`~.v21.TargetObjectValue`
:obj:`~.v21.TargetReportPeriod`
:obj:`~.v21.TextAttributeValue`
:obj:`~.v21.TimeRangeValue`
:obj:`~.v21.XHTMLAttributeValue`
13 changes: 10 additions & 3 deletions doc/api/model-v30-list.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

:obj:`~.v30.AfterPeriod`
:obj:`~.v30.BeforePeriod`
:obj:`~.v30.CodedMetadataAttributeValue`
:obj:`~.v30.CodelistExtension`
:obj:`~.v30.CodingFormat`
:obj:`~.v30.Constraint`
:obj:`~.v30.DataConstraint`
:obj:`~.v30.DataKey`
Expand All @@ -17,25 +17,32 @@
:obj:`~.v30.GeoGridCodelist`
:obj:`~.v30.GeoRefCode`
:obj:`~.v30.GeographicCodelist`
:obj:`~.v30.HierarchicalCode`
:obj:`~.v30.Hierarchy`
:obj:`~.v30.HierarchyAssociation`
:obj:`~.v30.Level`
:obj:`~.v30.IdentifiableObjectSelection`
:obj:`~.v30.Measure`
:obj:`~.v30.MeasureDescriptor`
:obj:`~.v30.MeasureRelationship`
:obj:`~.v30.MemberSelection`
:obj:`~.v30.MemberValue`
:obj:`~.v30.MetadataAttributeDescriptor`
:obj:`~.v30.MetadataAttributeValue`
:obj:`~.v30.MetadataConstraint`
:obj:`~.v30.MetadataProvider`
:obj:`~.v30.MetadataProviderScheme`
:obj:`~.v30.MetadataSet`
:obj:`~.v30.MetadataStructureDefinition`
:obj:`~.v30.Metadataflow`
:obj:`~.v30.Observation`
:obj:`~.v30.ObservationRelationship`
:obj:`~.v30.OtherUncodedAttributeValue`
:obj:`~.v30.RangePeriod`
:obj:`~.v30.SelectionValue`
:obj:`~.v30.StructureSpecificDataSet`
:obj:`~.v30.TargetIdentifiableObject`
:obj:`~.v30.TextAttributeValue`
:obj:`~.v30.TimeRangeValue`
:obj:`~.v30.UncodedMetadataAttributeValue`
:obj:`~.v30.ValueItem`
:obj:`~.v30.ValueList`
:obj:`~.v30.XHTMLAttributeValue`
2 changes: 0 additions & 2 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,11 @@ def linkcode_resolve(domain, info):
# If True, todo and todolist produce output, else they produce nothing
todo_include_todos = True


# -- Options for IPython.sphinxext.ipython_directive -----------------------------------

# Specify if the embedded Sphinx shell should import Matplotlib and set the backend
ipython_mplbackend = ""


# -- Dynamic configuration


Expand Down
8 changes: 6 additions & 2 deletions doc/dev.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ Address any failures before releasing.
Internal code reference
=======================

.. automodule:: sdmx.dictlike
:noindex:
:undoc-members:
:show-inheritance:

``testing``: Testing utilities
------------------------------

Expand All @@ -147,13 +152,12 @@ Internal code reference

``util``: Utilities
-------------------

.. automodule:: sdmx.util
:noindex:
:members: summarize_dictlike
:undoc-members:
:show-inheritance:


Inline TODOs
============

Expand Down
65 changes: 63 additions & 2 deletions doc/whatsnew.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,69 @@
What's new?
***********

.. Next release
.. ============
Next release
============

- Expand :mod:`.model` and :mod:`.reader.xml` support for metadata structures and metadata sets (§7 of the Information Model in both SDMX 2.1 and 3.0) (:issue:`73`, :pull:`152`).
This includes the additional classes:

- :mod:`.model.common`:
:class:`.CodingFormat`
:class:`.ExtendedFacetValueType`
:class:`.HierarchicalCode`
:class:`.Level`.
- :mod:`.model.v21`:
:class:`.CodelistMap`
:class:`.CodeMap`
:class:`.DataSetTarget`
:class:`.DimensionDescriptorValuesTarget`
:class:`.EnumeratedAttributeValue`
:class:`.IdentifiableObjectTarget`
:class:`.ItemAssociation`
:class:`.ItemSchemeMap`
:class:`.MetadataReport`
:class:`.MetadataSet`
:class:`.MetadataTarget`
:class:`.NonEnumeratedAttributeValue`
:class:`.OtherNonEnumeratedAttributeValue`
:class:`.ReportedAttribute`
:class:`.ReportingCategory`
:class:`.ReportingTaxonomy`
:class:`.ReportPeriodTarget`
:class:`.ReportStructure`
:class:`.StructureSet`
:class:`.TargetIdentifiableObject`
:class:`.TargetObject`
:class:`.TargetObjectKey`
:class:`.TargetObjectValue`
:class:`.TargetReportPeriod`
:class:`.TextAttributeValue`
:class:`.XHTMLAttributeValue`.
- :mod:`.model.v30`:
:class:`.CodedMetadataAttributeValue`
:class:`.IdentifiableObjectSelection`
:class:`.MetadataAttributeDescriptor`
:class:`.MetadataAttributeValue`
:class:`.Metadataflow`
:class:`.MetadataSet`
:class:`.MetadataStructureDefinition`
:class:`.OtherUncodedAttributeValue`
:class:`.TargetIdentifiableObject`
:class:`.TextAttributeValue`
:class:`.UncodedMetadataAttributeValue`
:class:`.XHTMLAttributeValue`.
- New collections on StructureMessage:
:attr:`.hierarchical_codelist`,
:attr:`.hierarchy`,
:attr:`.metadatastructure`.
- New class :class:`.MetadataMessage`.
- Improve :class:`.Structure`:

- New attribute :attr:`~.Structure.grouping` per the information model.
- New convenience method :meth:`~.Structure.replace_grouping`.
- :mod:`.reader.xml` parses messages available from 'actualconstraint', 'allowedconstraint', 'contentconstraint', 'hierarchicalcodelist', 'metadatstructure', 'structure', and 'structureset' SDMX 2.1 REST API endpoints for all known data sources that support these.

- Expand explicit marking of particular data sources that do not support the above endpoints.

v2.12.1 (2023-12-20)
====================
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ omit = [
exclude_also = [
# Don't complain about abstract methods, they aren't run
"@(abc\\.)?abstractmethod",
# Imports only used by type checkers
"if TYPE_CHECKING:",
]

[tool.mypy]
Expand Down
21 changes: 13 additions & 8 deletions sdmx/format/xml/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
"DataConsumerScheme",
"DataProvider",
"DataProviderScheme",
"HierarchicalCode",
"Level",
"NamePersonalisation",
"NamePersonalisationScheme",
"Ruleset",
Expand All @@ -39,17 +41,14 @@
("model.Agency", "str:Agency"), # Order matters
("model.Agency", "mes:Receiver"),
("model.Agency", "mes:Sender"),
("model.AttributeDescriptor", "str:AttributeList"),
("model.Concept", "str:ConceptIdentity"),
("model.Codelist", "str:Enumeration"), # This could possibly be ItemScheme
("model.Dimension", "str:Dimension"), # Order matters
("model.Dimension", "str:DimensionReference"),
("model.Dimension", "str:GroupDimension"),
("model.StructureUsage", "com:StructureUsage"),
("model.AttributeDescriptor", "str:AttributeList"),
("model.DataAttribute", "str:Attribute"),
("model.DataStructureDefinition", "str:DataStructure"),
("model.DataStructureDefinition", "com:Structure"),
("model.DataStructureDefinition", "str:Structure"),
("model.DimensionDescriptor", "str:DimensionList"),
("model.GroupDimensionDescriptor", "str:Group"),
("model.GroupDimensionDescriptor", "str:AttachmentGroup"),
Expand All @@ -58,10 +57,14 @@
("model.MeasureDescriptor", "str:MeasureList"),
("model.MetadataStructureDefinition", "str:MetadataStructure"),
("model.SeriesKey", "gen:SeriesKey"),
("model.Structure", "com:Structure"),
("model.Structure", "str:Structure"),
("model.StructureUsage", "com:StructureUsage"),
("model.VTLMappingScheme", "str:VtlMappingScheme"),
# Message classes
("message.DataMessage", "mes:StructureSpecificData"),
("message.MetadataMessage", "mes:GenericMetadata"),
("message.MetadataMessage", "mes:StructureSpecificMetadata"),
("message.ErrorMessage", "mes:Error"),
("message.StructureMessage", "mes:Structure"),
]
Expand All @@ -72,6 +75,7 @@
"xsi": "http://www.w3.org/2001/XMLSchema-instance",
# To be formatted
"com": "{}/common",
"md": "{}/metadata/generic",
"data": "{}/data/structurespecific",
"str": "{}/structure",
"mes": "{}/message",
Expand Down Expand Up @@ -123,15 +127,16 @@ def qname(self, ns_or_name, name=None) -> QName:
else:
if name is None:
match = re.fullmatch(
r"(\{(?P<ns_full>.*)\}|(?P<ns_key>.*):)(?P<name>.*)", ns_or_name
r"(\{(?P<ns_full>.*)\}|(?P<ns_key>.*):)?(?P<name>.*)", ns_or_name
)
assert match
name = match.group("name")
ns_key = match.group("ns_key")
if ns_key:
if ns_key := match.group("ns_key"):
ns = self.NS[ns_key]
elif ns := match.group("ns_full"):
pass
else:
ns = match.group("ns_full")
ns = None
else:
ns = self.NS[ns_or_name]

Expand Down
Loading