Skip to content

Citation

Citation

Bases: UUIDBaseNode

Definition

The Citation sub-object essentially houses the Reference nodes. The citation sub-object provides a link to papers, books, or other scholarly work and allows users to specify in what way the work relates to that data.

Attributes
attribute type example description required vocab
type str derived_from key for identifier True True
reference Reference reference to a book, paper, or scholarly work True
JSON Representation
"citation": {
        "node": ["Citation"],
        "type": "reference",
        "reference": {
                "node": ["Reference"],
                "type": "journal_article",
                "title": "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: SOft coarse grained Monte-Carlo Acceleration (SOMA)",
                "author": ["Ludwig Schneider", "Marcus Müller"],
                "journal": "Computer Physics Communications",
                "publisher": "Elsevier",
                "year": 2019,
                "pages": [463, 476],
                "doi": "10.1016/j.cpc.2018.08.011",
                "issn": "0010-4655",
                "website": "https://www.sciencedirect.com/science/article/pii/S0010465518303072",
        },
}

Valid Parent Nodes
Valid Sub-objects
  • None

Source code in cript/nodes/subobjects/citation.py
class Citation(UUIDBaseNode):
    """
    ## Definition
    The [Citation sub-object](https://pubs.acs.org/doi/suppl/10.1021/acscentsci.3c00011/suppl_file/oc3c00011_si_001.pdf#page=26)
    essentially houses the [Reference nodes](../../primary_nodes/reference).
    The `citation` sub-object provides a link to papers, books, or other scholarly work
    and allows users to specify in what way the work relates to that data.

    ## Attributes
    | attribute | type      | example      | description                                   | required | vocab |
    |-----------|-----------|--------------|-----------------------------------------------|----------|-------|
    | type      | str       | derived_from | key for identifier                            | True     | True  |
    | reference | Reference |              | reference to a book, paper, or scholarly work | True     |       |

    ## JSON Representation
    ```json
    "citation": {
            "node": ["Citation"],
            "type": "reference",
            "reference": {
                    "node": ["Reference"],
                    "type": "journal_article",
                    "title": "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: SOft coarse grained Monte-Carlo Acceleration (SOMA)",
                    "author": ["Ludwig Schneider", "Marcus Müller"],
                    "journal": "Computer Physics Communications",
                    "publisher": "Elsevier",
                    "year": 2019,
                    "pages": [463, 476],
                    "doi": "10.1016/j.cpc.2018.08.011",
                    "issn": "0010-4655",
                    "website": "https://www.sciencedirect.com/science/article/pii/S0010465518303072",
            },
    }
    ```

    ---

    ## Valid Parent Nodes
    * [Collection node](../../primary_nodes/collection)
    * [Computation node](../../primary_nodes/computation)
    * [Computation Process Node](../../primary_nodes/computation_process)
    * [Data node](../../primary_nodes/data)

    * [Computational Forcefield sub-objects](../computational_forcefield)
    * [Property sub-object](../property)
    * [Algorithm sub-object](../algorithm)
    * [Equipment sub-object](../equipment)


    ## Valid Sub-objects
    * `None`

    ---
    """

    @dataclass(frozen=True)
    class JsonAttributes(UUIDBaseNode.JsonAttributes):
        type: str = ""
        reference: Optional[Reference] = None

    _json_attrs: JsonAttributes = JsonAttributes()

    @beartype
    def __init__(self, type: str, reference: Reference, **kwargs):
        """
        create a Citation sub-object

        Parameters
        ----------
        type : citation type
            citation type must come from [CRIPT Controlled Vocabulary](https://app.criptapp.org/vocab/citation_type)
        reference : Reference
            Reference node

        Examples
        -------
        >>> import cript
        >>> title = (
        ...     "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: "
        ...     "Soft coarse grained Monte-Carlo Acceleration (SOMA)"
        ... )
        >>> my_reference = cript.Reference(
        ...     "journal_article",
        ...     title=title,
        ...     author=["Ludwig Schneider", "Marcus Müller"],
        ...     journal="Computer Physics Communications",
        ...     publisher="Elsevier",
        ...     year=2019,
        ...     pages=[463, 476],
        ...     doi="10.1016/j.cpc.2018.08.011",
        ...     issn="0010-4655",
        ...     website="https://www.sciencedirect.com/science/article/pii/S0010465518303072",
        ... )
        >>> my_citation = cript.Citation(type="reference", reference=my_reference)


        Returns
        -------
        None
            Instantiate citation sub-object
        """
        super().__init__(**kwargs)
        self._json_attrs = replace(self._json_attrs, type=type, reference=reference)
        self.validate()

    @property
    @beartype
    def type(self) -> str:
        """
        Citation type sub-object

        Citation type must come from [CRIPT Controlled Vocabulary](https://app.criptapp.org/vocab/citation_type)

        Examples
        --------
        >>> import cript
        >>> title = (
        ...     "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: "
        ...     "Soft coarse grained Monte-Carlo Acceleration (SOMA)"
        ... )
        >>> my_reference = cript.Reference(
        ...     "journal_article",
        ...     title=title,
        ...     author=["Ludwig Schneider", "Marcus Müller"],
        ...     journal="Computer Physics Communications",
        ...     publisher="Elsevier",
        ...     year=2019,
        ...     pages=[463, 476],
        ...     doi="10.1016/j.cpc.2018.08.011",
        ...     issn="0010-4655",
        ...     website="https://www.sciencedirect.com/science/article/pii/S0010465518303072",
        ... )
        >>> my_citation = cript.Citation(type="reference", reference=my_reference)
        >>> my_citation.type = "extracted_by_algorithm"

        Returns
        -------
        str
            Citation type
        """
        return self._json_attrs.type

    @type.setter
    @beartype
    def type(self, new_type: str) -> None:
        """
        set the citation sub-object type

        Parameters
        ----------
        new_type : str
            citation type

        Returns
        -------
        None
        """
        new_attrs = replace(self._json_attrs, type=new_type)
        self._update_json_attrs_if_valid(new_attrs)

    @property
    @beartype
    def reference(self) -> Union[Reference, None]:
        """
        citation reference node

        Examples
        --------
        >>> import cript
        >>> title = (
        ...     "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: "
        ...     "Soft coarse grained Monte-Carlo Acceleration (SOMA)"
        ... )
        >>> my_reference = cript.Reference(
        ...     "journal_article",
        ...     title=title,
        ...     author=["Ludwig Schneider", "Marcus Müller"],
        ...     journal="Computer Physics Communications",
        ...     publisher="Elsevier",
        ...     year=2019,
        ...     pages=[463, 476],
        ...     doi="10.1016/j.cpc.2018.08.011",
        ...     issn="0010-4655",
        ...     website="https://www.sciencedirect.com/science/article/pii/S0010465518303072",
        ... )
        >>> my_citation = cript.Citation(type="reference", reference=my_reference)
        >>> my_new_reference = cript.Reference(
        ...     type="journal_article",
        ...     title="'Living' Polymers",
        ...     author=["Dylan J. Walsh", "Bradley D. Olsen"],
        ...     journal="Nature",
        ...     publisher="Springer",
        ...     year=2019,
        ...     volume=3,
        ...     issue=5,
        ...     pages=[123, 456, 789],
        ...     doi="10.1038/1781168a0",
        ...     issn="1476-4687",
        ...     arxiv_id="1501",
        ...     pmid=12345678,
        ...     website="https://criptapp.org",
        ... )
        >>> my_citation.reference = my_new_reference

        Returns
        -------
        Reference
            Reference node
        """
        return self._json_attrs.reference

    @reference.setter
    @beartype
    def reference(self, new_reference: Reference) -> None:
        """
        replace the current Reference node for the citation sub-object

        Parameters
        ----------
        new_reference : Reference

        Returns
        -------
        None
        """
        new_attrs = replace(self._json_attrs, reference=new_reference)
        self._update_json_attrs_if_valid(new_attrs)

reference: Union[Reference, None] property writable

citation reference node

Examples:

>>> import cript
>>> title = (
...     "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: "
...     "Soft coarse grained Monte-Carlo Acceleration (SOMA)"
... )
>>> my_reference = cript.Reference(
...     "journal_article",
...     title=title,
...     author=["Ludwig Schneider", "Marcus Müller"],
...     journal="Computer Physics Communications",
...     publisher="Elsevier",
...     year=2019,
...     pages=[463, 476],
...     doi="10.1016/j.cpc.2018.08.011",
...     issn="0010-4655",
...     website="https://www.sciencedirect.com/science/article/pii/S0010465518303072",
... )
>>> my_citation = cript.Citation(type="reference", reference=my_reference)
>>> my_new_reference = cript.Reference(
...     type="journal_article",
...     title="'Living' Polymers",
...     author=["Dylan J. Walsh", "Bradley D. Olsen"],
...     journal="Nature",
...     publisher="Springer",
...     year=2019,
...     volume=3,
...     issue=5,
...     pages=[123, 456, 789],
...     doi="10.1038/1781168a0",
...     issn="1476-4687",
...     arxiv_id="1501",
...     pmid=12345678,
...     website="https://criptapp.org",
... )
>>> my_citation.reference = my_new_reference

Returns:

Type Description
Reference

Reference node

type: str property writable

Citation type sub-object

Citation type must come from CRIPT Controlled Vocabulary

Examples:

>>> import cript
>>> title = (
...     "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: "
...     "Soft coarse grained Monte-Carlo Acceleration (SOMA)"
... )
>>> my_reference = cript.Reference(
...     "journal_article",
...     title=title,
...     author=["Ludwig Schneider", "Marcus Müller"],
...     journal="Computer Physics Communications",
...     publisher="Elsevier",
...     year=2019,
...     pages=[463, 476],
...     doi="10.1016/j.cpc.2018.08.011",
...     issn="0010-4655",
...     website="https://www.sciencedirect.com/science/article/pii/S0010465518303072",
... )
>>> my_citation = cript.Citation(type="reference", reference=my_reference)
>>> my_citation.type = "extracted_by_algorithm"

Returns:

Type Description
str

Citation type

__init__(type, reference, **kwargs)

create a Citation sub-object

Parameters:

Name Type Description Default
type citation type

citation type must come from CRIPT Controlled Vocabulary

required
reference Reference

Reference node

required

Examples:

>>> import cript
>>> title = (
...     "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: "
...     "Soft coarse grained Monte-Carlo Acceleration (SOMA)"
... )
>>> my_reference = cript.Reference(
...     "journal_article",
...     title=title,
...     author=["Ludwig Schneider", "Marcus Müller"],
...     journal="Computer Physics Communications",
...     publisher="Elsevier",
...     year=2019,
...     pages=[463, 476],
...     doi="10.1016/j.cpc.2018.08.011",
...     issn="0010-4655",
...     website="https://www.sciencedirect.com/science/article/pii/S0010465518303072",
... )
>>> my_citation = cript.Citation(type="reference", reference=my_reference)

Returns:

Type Description
None

Instantiate citation sub-object

Source code in cript/nodes/subobjects/citation.py
@beartype
def __init__(self, type: str, reference: Reference, **kwargs):
    """
    create a Citation sub-object

    Parameters
    ----------
    type : citation type
        citation type must come from [CRIPT Controlled Vocabulary](https://app.criptapp.org/vocab/citation_type)
    reference : Reference
        Reference node

    Examples
    -------
    >>> import cript
    >>> title = (
    ...     "Multi-architecture Monte-Carlo (MC) simulation of soft coarse-grained polymeric materials: "
    ...     "Soft coarse grained Monte-Carlo Acceleration (SOMA)"
    ... )
    >>> my_reference = cript.Reference(
    ...     "journal_article",
    ...     title=title,
    ...     author=["Ludwig Schneider", "Marcus Müller"],
    ...     journal="Computer Physics Communications",
    ...     publisher="Elsevier",
    ...     year=2019,
    ...     pages=[463, 476],
    ...     doi="10.1016/j.cpc.2018.08.011",
    ...     issn="0010-4655",
    ...     website="https://www.sciencedirect.com/science/article/pii/S0010465518303072",
    ... )
    >>> my_citation = cript.Citation(type="reference", reference=my_reference)


    Returns
    -------
    None
        Instantiate citation sub-object
    """
    super().__init__(**kwargs)
    self._json_attrs = replace(self._json_attrs, type=type, reference=reference)
    self.validate()