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_statements(self):
self.statements.append(
wdi_core.WDItemID(self.instance_of_qid, PROPS['instance of'], references=[self.reference]))
self.statements.append(wdi_core.WDMonolingualText(self.title, PROPS['title'], references=[self.reference]))
if self.publication_date:
date = self.publication_date.strftime("+%Y-%m-%dT00:00:00Z")
self.statements.append(
wdi_core.WDTime(date, PROPS['publication date'], references=[self.reference]))
if self.published_in_qid:
self.statements.append(
wdi_core.WDItemID(self.published_in_qid, PROPS['published in'], references=[self.reference]))
if self.volume:
self.statements.append(wdi_core.WDString(self.volume, PROPS['volume'], references=[self.reference]))
if self.pages:
self.statements.append(wdi_core.WDString(self.pages, PROPS['page(s)'], references=[self.reference]))
if self.issue:
self.statements.append(wdi_core.WDString(self.issue, PROPS['issue'], references=[self.reference]))
: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
"""
self.language = language
value = (value, language)
super(WDMonolingualText, 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)
def make_statements(self, ordinals=None):
"""
:param ordinals: passed to self.make_author_statements
: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']:
: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
"""
self.language = language
value = (value, language)
super(WDMonolingualText, 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)