statcatlib.urn¶
Generated from the docstrings.
urn ¶
Convenience URN builders for SDMX artefact references.
Instead of hand-typing long URN strings, use these helpers::
import statcatlib as sc
store.codelist(sc.urn.codelist("SDMX", "CL_GEO", "1.0"))
store.codelist(sc.urn.codelist("ESTAT", "CL_GEO")) # version defaults to "1.0"
# Parse a URN back into components
parsed = sc.urn.parse("urn:sdmx:org.sdmx.infomodel.codelist.Codelist=SDMX:CL_GEO(1.0)")
parsed.agency # "SDMX"
parsed.id # "CL_GEO"
parsed.version # "1.0"
codelist ¶
Build a codelist URN string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agency
|
str
|
The maintenance agency's id. |
required |
id
|
str
|
The codelist's id. |
required |
version
|
str
|
Its version. |
'1.0'
|
Returns:
| Type | Description |
|---|---|
str
|
The URN, as SDMX spells it. |
Example
sc.urn.codelist("SDMX", "CL_GEO", "1.0")
→ "urn:sdmx:org.sdmx.infomodel.codelist.Codelist=SDMX:CL_GEO(1.0)"¶
dataflow ¶
Build a dataflow URN string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agency
|
str
|
The maintenance agency's id. |
required |
id
|
str
|
The dataflow's id. |
required |
version
|
str
|
Its version. |
'1.0'
|
Returns:
| Type | Description |
|---|---|
str
|
The URN, as SDMX spells it. |
Example
sc.urn.dataflow("ESTAT", "NAMA_10_GDP", "1.0")
→ "urn:sdmx:org.sdmx.infomodel.datastructure.Dataflow=ESTAT:NAMA_10_GDP(1.0)"¶
data_structure ¶
Build a data structure definition URN string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agency
|
str
|
The maintenance agency's id. |
required |
id
|
str
|
The data structure definition's id. |
required |
version
|
str
|
Its version. |
'1.0'
|
Returns:
| Type | Description |
|---|---|
str
|
The URN, as SDMX spells it. |
Example
sc.urn.data_structure("ESTAT", "DSD_NAMA_10_GDP", "1.0")
→ "urn:sdmx:org.sdmx.infomodel.datastructure.DataStructure=ESTAT:DSD_NAMA_10_GDP(1.0)"¶
concept_scheme ¶
Build a concept scheme URN string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agency
|
str
|
The maintenance agency's id. |
required |
id
|
str
|
The concept scheme's id. |
required |
version
|
str
|
Its version. |
'1.0'
|
Returns:
| Type | Description |
|---|---|
str
|
The URN, as SDMX spells it. |
Example
sc.urn.concept_scheme("SDMX", "CS_FREQ", "1.0")
→ "urn:sdmx:org.sdmx.infomodel.conceptscheme.ConceptScheme=SDMX:CS_FREQ(1.0)"¶
parse ¶
Parse a URN string into its components.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
urn
|
str
|
An SDMX URN string. One that is not valid raises |
required |
Returns:
| Type | Description |
|---|---|
SdmxUrn[object]
|
The parsed URN, with |
SdmxUrn[object]
|
and |
Example
parsed = sc.urn.parse("urn:sdmx:org.sdmx.infomodel.codelist.Codelist=SDMX:CL_GEO(1.0)") parsed.agency # "SDMX" parsed.id # "CL_GEO" parsed.version # "1.0" str(parsed) # round-trips to original URN string