Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def make_ext_id_statements(self):
for id_type, id_value in self.ids.items():
if id_value:
id_value = id_value.upper()
self.statements.append(wdi_core.WDExternalID(id_value, self.ID_TYPES[id_type], references=[self.reference]))
s.append(wdi_core.WDMonolingualText(self.meta['title'], self.PROPS['title'], references=[self.reference]))
s.append(wdi_core.WDTime(self.meta['date'], self.PROPS['publication date'], references=[self.reference]))
s.append(wdi_core.WDItemID(self.meta['journal_wdid'], self.PROPS['published in'], references=[self.reference]))
s.extend(self.make_author_statements(ordinals=ordinals))
### Optional statements
if self.meta['pmid']:
s.append(wdi_core.WDExternalID(self.meta['pmid'], self.PROPS['PubMed ID'], references=[self.reference]))
if self.meta['volume']:
s.append(wdi_core.WDString(self.meta['volume'], self.PROPS['volume'], references=[self.reference]))
if self.meta['pages']:
s.append(wdi_core.WDString(self.meta['pages'], self.PROPS['page(s)'], references=[self.reference]))
if self.meta['issue']:
s.append(wdi_core.WDString(self.meta['issue'], self.PROPS['issue'], references=[self.reference]))
if self.meta['doi']:
s.append(wdi_core.WDExternalID(self.meta['doi'].upper(), self.PROPS['DOI'], references=[self.reference]))
if self.meta['pmcid']:
s.append(wdi_core.WDExternalID(self.meta['pmcid'].replace("PMC", ""), self.PROPS['PMCID'],
references=[self.reference]))
self.statements = s
s.append(wdi_core.WDItemID(self.meta['journal_wdid'], self.PROPS['published in'], references=[self.reference]))
s.extend(self.make_author_statements(ordinals=ordinals))
### Optional statements
if self.meta['pmid']:
s.append(wdi_core.WDExternalID(self.meta['pmid'], self.PROPS['PubMed ID'], references=[self.reference]))
if self.meta['volume']:
s.append(wdi_core.WDString(self.meta['volume'], self.PROPS['volume'], references=[self.reference]))
if self.meta['pages']:
s.append(wdi_core.WDString(self.meta['pages'], self.PROPS['page(s)'], references=[self.reference]))
if self.meta['issue']:
s.append(wdi_core.WDString(self.meta['issue'], self.PROPS['issue'], references=[self.reference]))
if self.meta['doi']:
s.append(wdi_core.WDExternalID(self.meta['doi'].upper(), self.PROPS['DOI'], references=[self.reference]))
if self.meta['pmcid']:
s.append(wdi_core.WDExternalID(self.meta['pmcid'].replace("PMC", ""), self.PROPS['PMCID'],
references=[self.reference]))
self.statements = s
:return:
"""
self.make_reference()
s = []
### Required statements
for pubtype in self.meta['pubtype_qid']:
s.append(wdi_core.WDItemID(pubtype, self.PROPS['instance of'], references=[self.reference]))
s.append(wdi_core.WDMonolingualText(self.meta['title'], self.PROPS['title'], references=[self.reference]))
s.append(wdi_core.WDTime(self.meta['date'], self.PROPS['publication date'], references=[self.reference]))
s.append(wdi_core.WDItemID(self.meta['journal_wdid'], self.PROPS['published in'], references=[self.reference]))
s.extend(self.make_author_statements(ordinals=ordinals))
### Optional statements
if self.meta['pmid']:
s.append(wdi_core.WDExternalID(self.meta['pmid'], self.PROPS['PubMed ID'], references=[self.reference]))
if self.meta['volume']:
s.append(wdi_core.WDString(self.meta['volume'], self.PROPS['volume'], references=[self.reference]))
if self.meta['pages']:
s.append(wdi_core.WDString(self.meta['pages'], self.PROPS['page(s)'], references=[self.reference]))
if self.meta['issue']:
s.append(wdi_core.WDString(self.meta['issue'], self.PROPS['issue'], references=[self.reference]))
if self.meta['doi']:
s.append(wdi_core.WDExternalID(self.meta['doi'].upper(), self.PROPS['DOI'], references=[self.reference]))
if self.meta['pmcid']:
s.append(wdi_core.WDExternalID(self.meta['pmcid'].replace("PMC", ""), self.PROPS['PMCID'],
references=[self.reference]))
self.statements = s
:type prop_nr: str with a 'P' prefix followed by digits
:param is_reference: Whether this snak is a reference
:type is_reference: boolean
:param is_qualifier: Whether this snak is a qualifier
:type is_qualifier: boolean
:param snak_type: The snak type, either 'value', 'somevalue' or 'novalue'
:type snak_type: str
:param references: List with reference objects
:type references: A WD data type with subclass of WDBaseDataType
:param qualifiers: List with qualifier objects
:type qualifiers: A WD data type with subclass of WDBaseDataType
:param rank: WD rank of a snak with value 'preferred', 'normal' or 'deprecated'
:type rank: str
"""
super(WDExternalID, self).__init__(value=value, snak_type=snak_type, data_type=self.DTYPE,
is_reference=is_reference, is_qualifier=is_qualifier, references=references,
qualifiers=qualifiers, rank=rank, prop_nr=prop_nr,
check_qualifier_equality=check_qualifier_equality)
self.set_value(value=value)