src/pybel/manager/models.py
def to_json(self, include_id: bool = False) -> Mapping[str, Any]:
        """Create a citation dictionary that is used to recreate the edge data dictionary of a :class:`BELGraph`.

        :param bool include_id: If true, includes the model identifier
        :return: Citation dictionary for the recreation of a :class:`BELGraph`.
        """
        result = CitationDict(
            namespace=self.db,
            identifier=self.db_id,
            name=self.title,
        )

        if include_id:
            result['id'] = self.id

        if self.title:
            result[NAME] = self.title

        if self.journal:
            result[CITATION_JOURNAL] = self.journal

        if self.volume:
            result[CITATION_VOLUME] = self.volume

        if self.pages:
            result[CITATION_PAGES] = self.pages

        if self.date:
            result[CITATION_DATE] = self.date.strftime('%Y-%m-%d')

        if self.first:
            result[CITATION_FIRST_AUTHOR] = self.first.name

        if self.last:
            result[CITATION_LAST_AUTHOR] = self.last.name

        if self.article_type:
            result[pc.CITATION_ARTICLE_TYPE] = self.article_type

        if self.authors:
            result[CITATION_AUTHORS] = sorted(
                author.name
                for author in self.authors
            )

        return result
Create a citation dictionary that is used to recreate the edge data dictionary of a :class:`BELGraph`.

        :param bool include_id: If true, includes the model identifier
        :return: Citation dictionary for the recreation of a :class:`BELGraph`.
        
Create a citation dictionary that is used to recreate the edge data dictionary of a :class:`BELGraph`.
Create a citation dictionary that is used to recreate the edge data dictionary of a : class : ` BELGraph ` .
def to_json(self, include_id: bool = False) -> Mapping[str, Any]:
        result = CitationDict(
            namespace=self.db,
            identifier=self.db_id,
            name=self.title,
        )
        if include_id:
            result['id'] = self.id
        if self.title:
            result[NAME] = self.title
        if self.journal:
            result[CITATION_JOURNAL] = self.journal
        if self.volume:
            result[CITATION_VOLUME] = self.volume
        if self.pages:
            result[CITATION_PAGES] = self.pages
        if self.date:
            result[CITATION_DATE] = self.date.strftime('%Y-%m-%d')
        if self.first:
            result[CITATION_FIRST_AUTHOR] = self.first.name
        if self.last:
            result[CITATION_LAST_AUTHOR] = self.last.name
        if self.article_type:
            result[pc.CITATION_ARTICLE_TYPE] = self.article_type
        if self.authors:
            result[CITATION_AUTHORS] = sorted(
                author.name
                for author in self.authors
            )
        return result
def to_json ( self , include_id : bool = False ) -> Mapping [ str , Any ] : result = CitationDict ( namespace = self . db , identifier = self . db_id , name = self . title , ) if include_id : result [ 'id' ] = self . id if self . title : result [ NAME ] = self . title if self . journal : result [ CITATION_JOURNAL ] = self . journal if self . volume : result [ CITATION_VOLUME ] = self . volume if self . pages : result [ CITATION_PAGES ] = self . pages if self . date : result [ CITATION_DATE ] = self . date . strftime ( '%Y-%m-%d' ) if self . first : result [ CITATION_FIRST_AUTHOR ] = self . first . name if self . last : result [ CITATION_LAST_AUTHOR ] = self . last . name if self . article_type : result [ pc . CITATION_ARTICLE_TYPE ] = self . article_type if self . authors : result [ CITATION_AUTHORS ] = sorted ( author . name for author in self . authors ) return result
Create a citation dictionary that is used to recreate the edge data dictionary of a :class:`BELGraph`.
Create a citation dictionary that is used to recreate the edge data dictionary of a : class : ` BELGraph ` .
"""Create a citation dictionary that is used to recreate the edge data dictionary of a :class:`BELGraph`.

        :param bool include_id: If true, includes the model identifier
        :return: Citation dictionary for the recreation of a :class:`BELGraph`.
        """
Citation dictionary for the recreation of a :class:`BELGraph`.
Citation dictionary for the recreation of a : class : ` BELGraph ` .
self
include_id
bool
If true, includes the model identifier
If true includes the model identifier