serializers
: Serializing bibliographic data¶
Stock serializers for Relaton bibliographic items.
bibxml
: BibXML element tree¶
Abstracts¶
- relaton.serializers.bibxml.abstracts.create_abstract(abstracts: List[GenericStringValue]) _Element [source]¶
Formats an
<abstract>
element.
Anchors¶
- relaton.serializers.bibxml.anchor.get_suitable_anchor(item: BibliographicItem) str [source]¶
From a
BibliographicItem
instance get best anchor value and return it as a string.Tries
ANCHOR_FORMATTERS
, and if none return a string then takes the first primarydocid
, (or the firstdocid
withscope
equal to “anchor”, or just the first docid).Ensures the value matches XSID schema.
- Parameters
item – a
bib_models.bibdata.BibliographicItem
instance- Returns str
a string to be used as anchor
- Return type
- Raises
ValueError – unable to obtain an anchor, e.g. item has no docids
- relaton.serializers.bibxml.anchor.to_valid_xsid(val: str) str [source]¶
Transforms a string into a valid xs:id value. Transformation is lossy and irreversible.
- relaton.serializers.bibxml.anchor.XSID_REGEX = re.compile('^[a-zA-Z_][-.\\w]*$')¶
A regular expression matching a full valid xs:id value.
- relaton.serializers.bibxml.anchor.XSID_ILLEGAL = re.compile('[^-.\\w]')¶
A regular expression matching xs:id characters that are invalid anywhere within an xs:id string.
References¶
Series¶
- relaton.serializers.bibxml.series.extract_doi_series(docid: DocID) Optional[Tuple[str, str]] [source]¶
- relaton.serializers.bibxml.series.extract_rfc_series(docid: DocID) Optional[Tuple[str, str]] [source]¶
- relaton.serializers.bibxml.series.extract_id_series(docid: DocID) Optional[Tuple[str, str]] [source]¶
- relaton.serializers.bibxml.series.extract_w3c_series(docid: DocID) Optional[Tuple[str, str]] [source]¶
- relaton.serializers.bibxml.series.extract_3gpp_tr_series(docid: DocID) Optional[Tuple[str, str]] [source]¶