From 415ec1e438a08a78daf1c32f182336a71eb79cd6 Mon Sep 17 00:00:00 2001 From: Jan Range Date: Tue, 25 Jun 2024 10:27:18 +0200 Subject: [PATCH] use `serialization_alias` for ld fields --- pyenzyme/model.py | 785 ++++++++++++++++++++-------------------------- 1 file changed, 337 insertions(+), 448 deletions(-) diff --git a/pyenzyme/model.py b/pyenzyme/model.py index a255378..334b18d 100644 --- a/pyenzyme/model.py +++ b/pyenzyme/model.py @@ -5,11 +5,13 @@ from typing import Optional, Generic, TypeVar from enum import Enum from uuid import uuid4 +from datetime import date, datetime # Filter Wrapper definition used to filter a list of objects # based on their attributes Cls = TypeVar("Cls") + class FilterWrapper(Generic[Cls]): """Wrapper class to filter a list of objects based on their attributes""" @@ -46,7 +48,8 @@ def add_namespace(obj, prefix: str | None, iri: str | None): elif iri and prefix is None: raise ValueError("If iri is provided, prefix must also be provided") - obj.ld_context[prefix] = iri # type: ignore + obj.ld_context[prefix] = iri # type: ignore + def validate_prefix(term: str | dict, prefix: str): """Validates that a term is prefixed with a given prefix @@ -64,13 +67,14 @@ def validate_prefix(term: str | dict, prefix: str): elif isinstance(term, str) and not term.startswith(prefix + ":"): raise ValueError(f"Term {term} is not prefixed with {prefix}") + # Model Definitions -class EnzymeMLDocument(BaseModel): - model_config: ConfigDict = ConfigDict( # type: ignore - validate_assigment = True, - ) # type: ignore +class EnzymeMLDocument(BaseModel): + model_config: ConfigDict = ConfigDict( # type: ignore + validate_assigment=True, + ) # type: ignore name: str references: list[str] = Field(default_factory=list) @@ -88,18 +92,18 @@ class EnzymeMLDocument(BaseModel): # JSON-LD fields ld_id: str = Field( - alias="@id", - default_factory=lambda: "enzml:EnzymeMLDocument/" + str(uuid4()) + serialization_alias="@id", + default_factory=lambda: "enzml:EnzymeMLDocument/" + str(uuid4()), ) ld_type: list[str] = Field( - alias="@type", - default_factory = lambda: [ + serialization_alias="@type", + default_factory=lambda: [ "enzml:EnzymeMLDocument", ], ) ld_context: dict[str, str | dict] = Field( - alias="@context", - default_factory = lambda: { + serialization_alias="@context", + default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/", @@ -111,7 +115,7 @@ class EnzymeMLDocument(BaseModel): "created": "schema:dateCreated", "modified": "schema:dateModified", "creators": "schema:creator", - } + }, ) def filter_creators(self, **kwargs) -> list[Creator]: @@ -222,13 +226,12 @@ def filter_parameters(self, **kwargs) -> list[Parameter]: return FilterWrapper[Parameter](self.parameters, **kwargs).filter() - def set_attr_term( self, attr: str, term: str | dict, prefix: str | None = None, - iri: str | None = None + iri: str | None = None, ): """Sets the term for a given attribute in the JSON-LD object @@ -239,7 +242,7 @@ def set_attr_term( # Using a prefix and term >> obj.set_attr_term("name", "schema:givenName", "schema", "http://schema.org") - # Using a dictionary term + # Usinng a dictionary term >> obj.set_attr_term("name", {"@id": "http://schema.org/givenName", "@type": "@id"}) Args: @@ -250,7 +253,9 @@ def set_attr_term( AssertionError: If the attribute is not found in the model """ - assert attr in self.model_fields, f"Attribute {attr} not found in {self.__class__.__name__}" + assert ( + attr in self.model_fields + ), f"Attribute {attr} not found in {self.__class__.__name__}" if prefix: validate_prefix(term, prefix) @@ -259,10 +264,7 @@ def set_attr_term( self.ld_context[attr] = term def add_type_term( - self, - term: str, - prefix: str | None = None, - iri: str | None = None + self, term: str, prefix: str | None = None, iri: str | None = None ): """Adds a term to the @type field of the JSON-LD object @@ -289,7 +291,6 @@ def add_type_term( add_namespace(self, prefix, iri) self.ld_type.append(term) - def add_to_creators( self, given_name: str, @@ -297,29 +298,22 @@ def add_to_creators( mail: str, **kwargs, ): - params = { - "given_name": given_name, - "family_name": family_name, - "mail": mail - } + params = {"given_name": given_name, "family_name": family_name, "mail": mail} if "id" in kwargs: params["id"] = kwargs["id"] - self.creators.append( - Creator(**params) - ) + self.creators.append(Creator(**params)) return self.creators[-1] - def add_to_vessels( self, id: str, name: str, volume: float, unit: UnitDefinition, - constant: bool= True, + constant: bool = True, **kwargs, ): params = { @@ -327,30 +321,27 @@ def add_to_vessels( "name": name, "volume": volume, "unit": unit, - "constant": constant + "constant": constant, } if "id" in kwargs: params["id"] = kwargs["id"] - self.vessels.append( - Vessel(**params) - ) + self.vessels.append(Vessel(**params)) return self.vessels[-1] - def add_to_proteins( self, id: str, name: str, - constant: bool= False, - sequence: Optional[str]= None, - vessel_id: Optional[str]= None, - ecnumber: Optional[str]= None, - organism: Optional[str]= None, - organism_tax_id: Optional[str]= None, - references: list[str]= [], + constant: bool = False, + sequence: Optional[str] = None, + vessel_id: Optional[str] = None, + ecnumber: Optional[str] = None, + organism: Optional[str] = None, + organism_tax_id: Optional[str] = None, + references: list[str] = [], **kwargs, ): params = { @@ -362,49 +353,40 @@ def add_to_proteins( "ecnumber": ecnumber, "organism": organism, "organism_tax_id": organism_tax_id, - "references": references + "references": references, } if "id" in kwargs: params["id"] = kwargs["id"] - self.proteins.append( - Protein(**params) - ) + self.proteins.append(Protein(**params)) return self.proteins[-1] - def add_to_complexes( self, id: str, - participants: list[str]= [], + participants: list[str] = [], **kwargs, ): - params = { - "id": id, - "participants": participants - } + params = {"id": id, "participants": participants} if "id" in kwargs: params["id"] = kwargs["id"] - self.complexes.append( - Complex(**params) - ) + self.complexes.append(Complex(**params)) return self.complexes[-1] - def add_to_small_molecules( self, id: str, name: str, - constant: bool= False, - vessel_id: Optional[str]= None, - canonical_smiles: Optional[str]= None, - inchikey: Optional[str]= None, - references: list[str]= [], + constant: bool = False, + vessel_id: Optional[str] = None, + canonical_smiles: Optional[str] = None, + inchikey: Optional[str] = None, + references: list[str] = [], **kwargs, ): params = { @@ -414,27 +396,24 @@ def add_to_small_molecules( "vessel_id": vessel_id, "canonical_smiles": canonical_smiles, "inchikey": inchikey, - "references": references + "references": references, } if "id" in kwargs: params["id"] = kwargs["id"] - self.small_molecules.append( - SmallMolecule(**params) - ) + self.small_molecules.append(SmallMolecule(**params)) return self.small_molecules[-1] - def add_to_reactions( self, id: str, name: str, - reversible: bool= False, - kinetic_law: Optional[Equation]= None, - species: list[ReactionElement]= [], - modifiers: list[str]= [], + reversible: bool = False, + kinetic_law: Optional[Equation] = None, + species: list[ReactionElement] = [], + modifiers: list[str] = [], **kwargs, ): params = { @@ -443,28 +422,25 @@ def add_to_reactions( "reversible": reversible, "kinetic_law": kinetic_law, "species": species, - "modifiers": modifiers + "modifiers": modifiers, } if "id" in kwargs: params["id"] = kwargs["id"] - self.reactions.append( - Reaction(**params) - ) + self.reactions.append(Reaction(**params)) return self.reactions[-1] - def add_to_measurements( self, id: str, name: str, - species: list[MeasurementData]= [], - group_id: Optional[str]= None, - ph: Optional[float]= None, - temperature: Optional[float]= None, - temperature_unit: Optional[UnitDefinition]= None, + species: list[MeasurementData] = [], + group_id: Optional[str] = None, + ph: Optional[float] = None, + temperature: Optional[float] = None, + temperature_unit: Optional[UnitDefinition] = None, **kwargs, ): params = { @@ -474,28 +450,24 @@ def add_to_measurements( "group_id": group_id, "ph": ph, "temperature": temperature, - "temperature_unit": temperature_unit + "temperature_unit": temperature_unit, } if "id" in kwargs: params["id"] = kwargs["id"] - self.measurements.append( - Measurement(**params) - ) + self.measurements.append(Measurement(**params)) return self.measurements[-1] - def add_to_equations( self, unit: UnitDefinition, equation_type: EquationType, equation: str, - species_id: Optional[str]= None, - id: Optional[str]= None, - variables: list[EqVariable]= [], - parameters: list[EqParameter]= [], + species_id: Optional[str] = None, + variables: list[EqVariable] = [], + parameters: list[EqParameter] = [], **kwargs, ): params = { @@ -503,32 +475,28 @@ def add_to_equations( "equation_type": equation_type, "equation": equation, "species_id": species_id, - "id": id, "variables": variables, - "parameters": parameters + "parameters": parameters, } if "id" in kwargs: params["id"] = kwargs["id"] - self.equations.append( - Equation(**params) - ) + self.equations.append(Equation(**params)) return self.equations[-1] - def add_to_parameters( self, id: str, name: str, - value: Optional[float]= None, - unit: Optional[UnitDefinition]= None, - initial_value: Optional[float]= None, - upper: Optional[float]= None, - lower: Optional[float]= None, - stderr: Optional[float]= None, - constant: Optional[bool]= True, + value: Optional[float] = None, + unit: Optional[UnitDefinition] = None, + initial_value: Optional[float] = None, + upper: Optional[float] = None, + lower: Optional[float] = None, + stderr: Optional[float] = None, + constant: Optional[bool] = True, **kwargs, ): params = { @@ -540,23 +508,21 @@ def add_to_parameters( "upper": upper, "lower": lower, "stderr": stderr, - "constant": constant + "constant": constant, } if "id" in kwargs: params["id"] = kwargs["id"] - self.parameters.append( - Parameter(**params) - ) + self.parameters.append(Parameter(**params)) return self.parameters[-1] -class Creator(BaseModel): - model_config: ConfigDict = ConfigDict( # type: ignore - validate_assigment = True, - ) # type: ignore +class Creator(BaseModel): + model_config: ConfigDict = ConfigDict( # type: ignore + validate_assigment=True, + ) # type: ignore given_name: str family_name: str @@ -564,34 +530,31 @@ class Creator(BaseModel): # JSON-LD fields ld_id: str = Field( - alias="@id", - default_factory=lambda: "enzml:Creator/" + str(uuid4()) + serialization_alias="@id", + default_factory=lambda: "enzml:Creator/" + str(uuid4()), ) ld_type: list[str] = Field( - alias="@type", - default_factory = lambda: [ - "enzml:Creator","schema:person" - ], + serialization_alias="@type", + default_factory=lambda: ["enzml:Creator", "schema:person"], ) ld_context: dict[str, str | dict] = Field( - alias="@context", - default_factory = lambda: { + serialization_alias="@context", + default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/", "given_name": "schema:givenName", "family_name": "schema:familyName", "mail": "schema:email", - } + }, ) - def set_attr_term( self, attr: str, term: str | dict, prefix: str | None = None, - iri: str | None = None + iri: str | None = None, ): """Sets the term for a given attribute in the JSON-LD object @@ -602,7 +565,7 @@ def set_attr_term( # Using a prefix and term >> obj.set_attr_term("name", "schema:givenName", "schema", "http://schema.org") - # Using a dictionary term + # Usinng a dictionary term >> obj.set_attr_term("name", {"@id": "http://schema.org/givenName", "@type": "@id"}) Args: @@ -613,7 +576,9 @@ def set_attr_term( AssertionError: If the attribute is not found in the model """ - assert attr in self.model_fields, f"Attribute {attr} not found in {self.__class__.__name__}" + assert ( + attr in self.model_fields + ), f"Attribute {attr} not found in {self.__class__.__name__}" if prefix: validate_prefix(term, prefix) @@ -622,10 +587,7 @@ def set_attr_term( self.ld_context[attr] = term def add_type_term( - self, - term: str, - prefix: str | None = None, - iri: str | None = None + self, term: str, prefix: str | None = None, iri: str | None = None ): """Adds a term to the @type field of the JSON-LD object @@ -654,10 +616,9 @@ def add_type_term( class Vessel(BaseModel): - - model_config: ConfigDict = ConfigDict( # type: ignore - validate_assigment = True, - ) # type: ignore + model_config: ConfigDict = ConfigDict( # type: ignore + validate_assigment=True, + ) # type: ignore id: str name: str @@ -667,18 +628,16 @@ class Vessel(BaseModel): # JSON-LD fields ld_id: str = Field( - alias="@id", - default_factory=lambda: "enzml:Vessel/" + str(uuid4()) + serialization_alias="@id", + default_factory=lambda: "enzml:Vessel/" + str(uuid4()), ) ld_type: list[str] = Field( - alias="@type", - default_factory = lambda: [ - "enzml:Vessel","OBO:OBI_0400081" - ], + serialization_alias="@type", + default_factory=lambda: ["enzml:Vessel", "OBO:OBI_0400081"], ) ld_context: dict[str, str | dict] = Field( - alias="@context", - default_factory = lambda: { + serialization_alias="@context", + default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/", @@ -688,16 +647,15 @@ class Vessel(BaseModel): }, "name": "schema:name", "volume": "OBO:OBI_0002139", - } + }, ) - def set_attr_term( self, attr: str, term: str | dict, prefix: str | None = None, - iri: str | None = None + iri: str | None = None, ): """Sets the term for a given attribute in the JSON-LD object @@ -708,7 +666,7 @@ def set_attr_term( # Using a prefix and term >> obj.set_attr_term("name", "schema:givenName", "schema", "http://schema.org") - # Using a dictionary term + # Usinng a dictionary term >> obj.set_attr_term("name", {"@id": "http://schema.org/givenName", "@type": "@id"}) Args: @@ -719,7 +677,9 @@ def set_attr_term( AssertionError: If the attribute is not found in the model """ - assert attr in self.model_fields, f"Attribute {attr} not found in {self.__class__.__name__}" + assert ( + attr in self.model_fields + ), f"Attribute {attr} not found in {self.__class__.__name__}" if prefix: validate_prefix(term, prefix) @@ -728,10 +688,7 @@ def set_attr_term( self.ld_context[attr] = term def add_type_term( - self, - term: str, - prefix: str | None = None, - iri: str | None = None + self, term: str, prefix: str | None = None, iri: str | None = None ): """Adds a term to the @type field of the JSON-LD object @@ -760,10 +717,9 @@ def add_type_term( class Protein(BaseModel): - - model_config: ConfigDict = ConfigDict( # type: ignore - validate_assigment = True, - ) # type: ignore + model_config: ConfigDict = ConfigDict( # type: ignore + validate_assigment=True, + ) # type: ignore id: str name: str @@ -777,18 +733,16 @@ class Protein(BaseModel): # JSON-LD fields ld_id: str = Field( - alias="@id", - default_factory=lambda: "enzml:Protein/" + str(uuid4()) + serialization_alias="@id", + default_factory=lambda: "enzml:Protein/" + str(uuid4()), ) ld_type: list[str] = Field( - alias="@type", - default_factory = lambda: [ - "enzml:Protein","schema:Protein" - ], + serialization_alias="@type", + default_factory=lambda: ["enzml:Protein", "schema:Protein"], ) ld_context: dict[str, str | dict] = Field( - alias="@context", - default_factory = lambda: { + serialization_alias="@context", + default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/", @@ -809,16 +763,15 @@ class Protein(BaseModel): "@id": "schema:citation", "@type": "@id", }, - } + }, ) - def set_attr_term( self, attr: str, term: str | dict, prefix: str | None = None, - iri: str | None = None + iri: str | None = None, ): """Sets the term for a given attribute in the JSON-LD object @@ -829,7 +782,7 @@ def set_attr_term( # Using a prefix and term >> obj.set_attr_term("name", "schema:givenName", "schema", "http://schema.org") - # Using a dictionary term + # Usinng a dictionary term >> obj.set_attr_term("name", {"@id": "http://schema.org/givenName", "@type": "@id"}) Args: @@ -840,7 +793,9 @@ def set_attr_term( AssertionError: If the attribute is not found in the model """ - assert attr in self.model_fields, f"Attribute {attr} not found in {self.__class__.__name__}" + assert ( + attr in self.model_fields + ), f"Attribute {attr} not found in {self.__class__.__name__}" if prefix: validate_prefix(term, prefix) @@ -849,10 +804,7 @@ def set_attr_term( self.ld_context[attr] = term def add_type_term( - self, - term: str, - prefix: str | None = None, - iri: str | None = None + self, term: str, prefix: str | None = None, iri: str | None = None ): """Adds a term to the @type field of the JSON-LD object @@ -881,28 +833,27 @@ def add_type_term( class Complex(BaseModel): - - model_config: ConfigDict = ConfigDict( # type: ignore - validate_assigment = True, - ) # type: ignore + model_config: ConfigDict = ConfigDict( # type: ignore + validate_assigment=True, + ) # type: ignore id: str participants: list[str] = Field(default_factory=list) # JSON-LD fields ld_id: str = Field( - alias="@id", - default_factory=lambda: "enzml:Complex/" + str(uuid4()) + serialization_alias="@id", + default_factory=lambda: "enzml:Complex/" + str(uuid4()), ) ld_type: list[str] = Field( - alias="@type", - default_factory = lambda: [ + serialization_alias="@type", + default_factory=lambda: [ "enzml:Complex", ], ) ld_context: dict[str, str | dict] = Field( - alias="@context", - default_factory = lambda: { + serialization_alias="@context", + default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/", @@ -913,16 +864,15 @@ class Complex(BaseModel): "participants": { "@type": "@id", }, - } + }, ) - def set_attr_term( self, attr: str, term: str | dict, prefix: str | None = None, - iri: str | None = None + iri: str | None = None, ): """Sets the term for a given attribute in the JSON-LD object @@ -933,7 +883,7 @@ def set_attr_term( # Using a prefix and term >> obj.set_attr_term("name", "schema:givenName", "schema", "http://schema.org") - # Using a dictionary term + # Usinng a dictionary term >> obj.set_attr_term("name", {"@id": "http://schema.org/givenName", "@type": "@id"}) Args: @@ -944,7 +894,9 @@ def set_attr_term( AssertionError: If the attribute is not found in the model """ - assert attr in self.model_fields, f"Attribute {attr} not found in {self.__class__.__name__}" + assert ( + attr in self.model_fields + ), f"Attribute {attr} not found in {self.__class__.__name__}" if prefix: validate_prefix(term, prefix) @@ -953,10 +905,7 @@ def set_attr_term( self.ld_context[attr] = term def add_type_term( - self, - term: str, - prefix: str | None = None, - iri: str | None = None + self, term: str, prefix: str | None = None, iri: str | None = None ): """Adds a term to the @type field of the JSON-LD object @@ -985,10 +934,9 @@ def add_type_term( class SmallMolecule(BaseModel): - - model_config: ConfigDict = ConfigDict( # type: ignore - validate_assigment = True, - ) # type: ignore + model_config: ConfigDict = ConfigDict( # type: ignore + validate_assigment=True, + ) # type: ignore id: str name: str @@ -1000,18 +948,18 @@ class SmallMolecule(BaseModel): # JSON-LD fields ld_id: str = Field( - alias="@id", - default_factory=lambda: "enzml:SmallMolecule/" + str(uuid4()) + serialization_alias="@id", + default_factory=lambda: "enzml:SmallMolecule/" + str(uuid4()), ) ld_type: list[str] = Field( - alias="@type", - default_factory = lambda: [ + serialization_alias="@type", + default_factory=lambda: [ "enzml:SmallMolecule", ], ) ld_context: dict[str, str | dict] = Field( - alias="@context", - default_factory = lambda: { + serialization_alias="@context", + default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/", @@ -1028,16 +976,15 @@ class SmallMolecule(BaseModel): "@id": "schema:citation", "@type": "@id", }, - } + }, ) - def set_attr_term( self, attr: str, term: str | dict, prefix: str | None = None, - iri: str | None = None + iri: str | None = None, ): """Sets the term for a given attribute in the JSON-LD object @@ -1048,7 +995,7 @@ def set_attr_term( # Using a prefix and term >> obj.set_attr_term("name", "schema:givenName", "schema", "http://schema.org") - # Using a dictionary term + # Usinng a dictionary term >> obj.set_attr_term("name", {"@id": "http://schema.org/givenName", "@type": "@id"}) Args: @@ -1059,7 +1006,9 @@ def set_attr_term( AssertionError: If the attribute is not found in the model """ - assert attr in self.model_fields, f"Attribute {attr} not found in {self.__class__.__name__}" + assert ( + attr in self.model_fields + ), f"Attribute {attr} not found in {self.__class__.__name__}" if prefix: validate_prefix(term, prefix) @@ -1068,10 +1017,7 @@ def set_attr_term( self.ld_context[attr] = term def add_type_term( - self, - term: str, - prefix: str | None = None, - iri: str | None = None + self, term: str, prefix: str | None = None, iri: str | None = None ): """Adds a term to the @type field of the JSON-LD object @@ -1100,10 +1046,9 @@ def add_type_term( class Reaction(BaseModel): - - model_config: ConfigDict = ConfigDict( # type: ignore - validate_assigment = True, - ) # type: ignore + model_config: ConfigDict = ConfigDict( # type: ignore + validate_assigment=True, + ) # type: ignore id: str name: str @@ -1114,18 +1059,18 @@ class Reaction(BaseModel): # JSON-LD fields ld_id: str = Field( - alias="@id", - default_factory=lambda: "enzml:Reaction/" + str(uuid4()) + serialization_alias="@id", + default_factory=lambda: "enzml:Reaction/" + str(uuid4()), ) ld_type: list[str] = Field( - alias="@type", - default_factory = lambda: [ + serialization_alias="@type", + default_factory=lambda: [ "enzml:Reaction", ], ) ld_context: dict[str, str | dict] = Field( - alias="@context", - default_factory = lambda: { + serialization_alias="@context", + default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/", @@ -1136,7 +1081,7 @@ class Reaction(BaseModel): "modifiers": { "@type": "@id", }, - } + }, ) def filter_species(self, **kwargs) -> list[ReactionElement]: @@ -1151,13 +1096,12 @@ def filter_species(self, **kwargs) -> list[ReactionElement]: return FilterWrapper[ReactionElement](self.species, **kwargs).filter() - def set_attr_term( self, attr: str, term: str | dict, prefix: str | None = None, - iri: str | None = None + iri: str | None = None, ): """Sets the term for a given attribute in the JSON-LD object @@ -1168,7 +1112,7 @@ def set_attr_term( # Using a prefix and term >> obj.set_attr_term("name", "schema:givenName", "schema", "http://schema.org") - # Using a dictionary term + # Usinng a dictionary term >> obj.set_attr_term("name", {"@id": "http://schema.org/givenName", "@type": "@id"}) Args: @@ -1179,7 +1123,9 @@ def set_attr_term( AssertionError: If the attribute is not found in the model """ - assert attr in self.model_fields, f"Attribute {attr} not found in {self.__class__.__name__}" + assert ( + attr in self.model_fields + ), f"Attribute {attr} not found in {self.__class__.__name__}" if prefix: validate_prefix(term, prefix) @@ -1188,10 +1134,7 @@ def set_attr_term( self.ld_context[attr] = term def add_type_term( - self, - term: str, - prefix: str | None = None, - iri: str | None = None + self, term: str, prefix: str | None = None, iri: str | None = None ): """Adds a term to the @type field of the JSON-LD object @@ -1218,67 +1161,59 @@ def add_type_term( add_namespace(self, prefix, iri) self.ld_type.append(term) - def add_to_species( self, species_id: str, stoichiometry: float, **kwargs, ): - params = { - "species_id": species_id, - "stoichiometry": stoichiometry - } + params = {"species_id": species_id, "stoichiometry": stoichiometry} if "id" in kwargs: params["id"] = kwargs["id"] - self.species.append( - ReactionElement(**params) - ) + self.species.append(ReactionElement(**params)) return self.species[-1] class ReactionElement(BaseModel): - - model_config: ConfigDict = ConfigDict( # type: ignore - validate_assigment = True, - ) # type: ignore + model_config: ConfigDict = ConfigDict( # type: ignore + validate_assigment=True, + ) # type: ignore species_id: str stoichiometry: float # JSON-LD fields ld_id: str = Field( - alias="@id", - default_factory=lambda: "enzml:ReactionElement/" + str(uuid4()) + serialization_alias="@id", + default_factory=lambda: "enzml:ReactionElement/" + str(uuid4()), ) ld_type: list[str] = Field( - alias="@type", - default_factory = lambda: [ + serialization_alias="@type", + default_factory=lambda: [ "enzml:ReactionElement", ], ) ld_context: dict[str, str | dict] = Field( - alias="@context", - default_factory = lambda: { + serialization_alias="@context", + default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/", "species_id": { "@type": "@id", }, - } + }, ) - def set_attr_term( self, attr: str, term: str | dict, prefix: str | None = None, - iri: str | None = None + iri: str | None = None, ): """Sets the term for a given attribute in the JSON-LD object @@ -1289,7 +1224,7 @@ def set_attr_term( # Using a prefix and term >> obj.set_attr_term("name", "schema:givenName", "schema", "http://schema.org") - # Using a dictionary term + # Usinng a dictionary term >> obj.set_attr_term("name", {"@id": "http://schema.org/givenName", "@type": "@id"}) Args: @@ -1300,7 +1235,9 @@ def set_attr_term( AssertionError: If the attribute is not found in the model """ - assert attr in self.model_fields, f"Attribute {attr} not found in {self.__class__.__name__}" + assert ( + attr in self.model_fields + ), f"Attribute {attr} not found in {self.__class__.__name__}" if prefix: validate_prefix(term, prefix) @@ -1309,10 +1246,7 @@ def set_attr_term( self.ld_context[attr] = term def add_type_term( - self, - term: str, - prefix: str | None = None, - iri: str | None = None + self, term: str, prefix: str | None = None, iri: str | None = None ): """Adds a term to the @type field of the JSON-LD object @@ -1341,43 +1275,38 @@ def add_type_term( class Equation(BaseModel): - - model_config: ConfigDict = ConfigDict( # type: ignore - validate_assigment = True, - ) # type: ignore + model_config: ConfigDict = ConfigDict( # type: ignore + validate_assigment=True, + ) # type: ignore unit: UnitDefinition equation_type: EquationType equation: str species_id: Optional[str] = Field(default=None) - id: Optional[str] = Field(default=None) variables: list[EqVariable] = Field(default_factory=list) parameters: list[EqParameter] = Field(default_factory=list) # JSON-LD fields ld_id: str = Field( - alias="@id", - default_factory=lambda: "enzml:Equation/" + str(uuid4()) + serialization_alias="@id", + default_factory=lambda: "enzml:Equation/" + str(uuid4()), ) ld_type: list[str] = Field( - alias="@type", - default_factory = lambda: [ + serialization_alias="@type", + default_factory=lambda: [ "enzml:Equation", ], ) ld_context: dict[str, str | dict] = Field( - alias="@context", - default_factory = lambda: { + serialization_alias="@context", + default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/", "species_id": { "@type": "@id", }, - "id": { - "@type": "@id", - }, - } + }, ) def filter_variables(self, **kwargs) -> list[EqVariable]: @@ -1404,13 +1333,12 @@ def filter_parameters(self, **kwargs) -> list[EqParameter]: return FilterWrapper[EqParameter](self.parameters, **kwargs).filter() - def set_attr_term( self, attr: str, term: str | dict, prefix: str | None = None, - iri: str | None = None + iri: str | None = None, ): """Sets the term for a given attribute in the JSON-LD object @@ -1421,7 +1349,7 @@ def set_attr_term( # Using a prefix and term >> obj.set_attr_term("name", "schema:givenName", "schema", "http://schema.org") - # Using a dictionary term + # Usinng a dictionary term >> obj.set_attr_term("name", {"@id": "http://schema.org/givenName", "@type": "@id"}) Args: @@ -1432,7 +1360,9 @@ def set_attr_term( AssertionError: If the attribute is not found in the model """ - assert attr in self.model_fields, f"Attribute {attr} not found in {self.__class__.__name__}" + assert ( + attr in self.model_fields + ), f"Attribute {attr} not found in {self.__class__.__name__}" if prefix: validate_prefix(term, prefix) @@ -1441,10 +1371,7 @@ def set_attr_term( self.ld_context[attr] = term def add_type_term( - self, - term: str, - prefix: str | None = None, - iri: str | None = None + self, term: str, prefix: str | None = None, iri: str | None = None ): """Adds a term to the @type field of the JSON-LD object @@ -1471,59 +1398,44 @@ def add_type_term( add_namespace(self, prefix, iri) self.ld_type.append(term) - def add_to_variables( self, id: str, name: str, - symbol: Optional[str]= None, + symbol: Optional[str] = None, **kwargs, ): - params = { - "id": id, - "name": name, - "symbol": symbol - } + params = {"id": id, "name": name, "symbol": symbol} if "id" in kwargs: params["id"] = kwargs["id"] - self.variables.append( - EqVariable(**params) - ) + self.variables.append(EqVariable(**params)) return self.variables[-1] - def add_to_parameters( self, id: str, name: str, - symbol: Optional[str]= None, - value: Optional[float]= None, + symbol: Optional[str] = None, + value: Optional[float] = None, **kwargs, ): - params = { - "id": id, - "name": name, - "symbol": symbol, - "value": value - } + params = {"id": id, "name": name, "symbol": symbol, "value": value} if "id" in kwargs: params["id"] = kwargs["id"] - self.parameters.append( - EqParameter(**params) - ) + self.parameters.append(EqParameter(**params)) return self.parameters[-1] -class Parameter(BaseModel): - model_config: ConfigDict = ConfigDict( # type: ignore - validate_assigment = True, - ) # type: ignore +class Parameter(BaseModel): + model_config: ConfigDict = ConfigDict( # type: ignore + validate_assigment=True, + ) # type: ignore id: str name: str @@ -1537,18 +1449,18 @@ class Parameter(BaseModel): # JSON-LD fields ld_id: str = Field( - alias="@id", - default_factory=lambda: "enzml:Parameter/" + str(uuid4()) + serialization_alias="@id", + default_factory=lambda: "enzml:Parameter/" + str(uuid4()), ) ld_type: list[str] = Field( - alias="@type", - default_factory = lambda: [ + serialization_alias="@type", + default_factory=lambda: [ "enzml:Parameter", ], ) ld_context: dict[str, str | dict] = Field( - alias="@context", - default_factory = lambda: { + serialization_alias="@context", + default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/", @@ -1556,16 +1468,15 @@ class Parameter(BaseModel): "@id": "schema:identifier", "@type": "@id", }, - } + }, ) - def set_attr_term( self, attr: str, term: str | dict, prefix: str | None = None, - iri: str | None = None + iri: str | None = None, ): """Sets the term for a given attribute in the JSON-LD object @@ -1576,7 +1487,7 @@ def set_attr_term( # Using a prefix and term >> obj.set_attr_term("name", "schema:givenName", "schema", "http://schema.org") - # Using a dictionary term + # Usinng a dictionary term >> obj.set_attr_term("name", {"@id": "http://schema.org/givenName", "@type": "@id"}) Args: @@ -1587,7 +1498,9 @@ def set_attr_term( AssertionError: If the attribute is not found in the model """ - assert attr in self.model_fields, f"Attribute {attr} not found in {self.__class__.__name__}" + assert ( + attr in self.model_fields + ), f"Attribute {attr} not found in {self.__class__.__name__}" if prefix: validate_prefix(term, prefix) @@ -1596,10 +1509,7 @@ def set_attr_term( self.ld_context[attr] = term def add_type_term( - self, - term: str, - prefix: str | None = None, - iri: str | None = None + self, term: str, prefix: str | None = None, iri: str | None = None ): """Adds a term to the @type field of the JSON-LD object @@ -1628,10 +1538,9 @@ def add_type_term( class Measurement(BaseModel): - - model_config: ConfigDict = ConfigDict( # type: ignore - validate_assigment = True, - ) # type: ignore + model_config: ConfigDict = ConfigDict( # type: ignore + validate_assigment=True, + ) # type: ignore id: str name: str @@ -1643,18 +1552,18 @@ class Measurement(BaseModel): # JSON-LD fields ld_id: str = Field( - alias="@id", - default_factory=lambda: "enzml:Measurement/" + str(uuid4()) + serialization_alias="@id", + default_factory=lambda: "enzml:Measurement/" + str(uuid4()), ) ld_type: list[str] = Field( - alias="@type", - default_factory = lambda: [ + serialization_alias="@type", + default_factory=lambda: [ "enzml:Measurement", ], ) ld_context: dict[str, str | dict] = Field( - alias="@context", - default_factory = lambda: { + serialization_alias="@context", + default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/", @@ -1665,7 +1574,7 @@ class Measurement(BaseModel): "group_id": { "@type": "@id", }, - } + }, ) def filter_species(self, **kwargs) -> list[MeasurementData]: @@ -1680,13 +1589,12 @@ def filter_species(self, **kwargs) -> list[MeasurementData]: return FilterWrapper[MeasurementData](self.species, **kwargs).filter() - def set_attr_term( self, attr: str, term: str | dict, prefix: str | None = None, - iri: str | None = None + iri: str | None = None, ): """Sets the term for a given attribute in the JSON-LD object @@ -1697,7 +1605,7 @@ def set_attr_term( # Using a prefix and term >> obj.set_attr_term("name", "schema:givenName", "schema", "http://schema.org") - # Using a dictionary term + # Usinng a dictionary term >> obj.set_attr_term("name", {"@id": "http://schema.org/givenName", "@type": "@id"}) Args: @@ -1708,7 +1616,9 @@ def set_attr_term( AssertionError: If the attribute is not found in the model """ - assert attr in self.model_fields, f"Attribute {attr} not found in {self.__class__.__name__}" + assert ( + attr in self.model_fields + ), f"Attribute {attr} not found in {self.__class__.__name__}" if prefix: validate_prefix(term, prefix) @@ -1717,10 +1627,7 @@ def set_attr_term( self.ld_context[attr] = term def add_type_term( - self, - term: str, - prefix: str | None = None, - iri: str | None = None + self, term: str, prefix: str | None = None, iri: str | None = None ): """Adds a term to the @type field of the JSON-LD object @@ -1747,7 +1654,6 @@ def add_type_term( add_namespace(self, prefix, iri) self.ld_type.append(term) - def add_to_species( self, species_id: str, @@ -1755,9 +1661,9 @@ def add_to_species( data_type: DataTypes, data_unit: UnitDefinition, time_unit: UnitDefinition, - time: list[float]= [], - data: list[float]= [], - is_calculated: bool= False, + time: list[float] = [], + data: list[float] = [], + is_calculated: bool = False, **kwargs, ): params = { @@ -1768,24 +1674,21 @@ def add_to_species( "time_unit": time_unit, "time": time, "data": data, - "is_calculated": is_calculated + "is_calculated": is_calculated, } if "id" in kwargs: params["id"] = kwargs["id"] - self.species.append( - MeasurementData(**params) - ) + self.species.append(MeasurementData(**params)) return self.species[-1] class MeasurementData(BaseModel): - - model_config: ConfigDict = ConfigDict( # type: ignore - validate_assigment = True, - ) # type: ignore + model_config: ConfigDict = ConfigDict( # type: ignore + validate_assigment=True, + ) # type: ignore species_id: str init_conc: float @@ -1798,34 +1701,33 @@ class MeasurementData(BaseModel): # JSON-LD fields ld_id: str = Field( - alias="@id", - default_factory=lambda: "enzml:MeasurementData/" + str(uuid4()) + serialization_alias="@id", + default_factory=lambda: "enzml:MeasurementData/" + str(uuid4()), ) ld_type: list[str] = Field( - alias="@type", - default_factory = lambda: [ + serialization_alias="@type", + default_factory=lambda: [ "enzml:MeasurementData", ], ) ld_context: dict[str, str | dict] = Field( - alias="@context", - default_factory = lambda: { + serialization_alias="@context", + default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/", "species_id": { "@type": "@id", }, - } + }, ) - def set_attr_term( self, attr: str, term: str | dict, prefix: str | None = None, - iri: str | None = None + iri: str | None = None, ): """Sets the term for a given attribute in the JSON-LD object @@ -1836,7 +1738,7 @@ def set_attr_term( # Using a prefix and term >> obj.set_attr_term("name", "schema:givenName", "schema", "http://schema.org") - # Using a dictionary term + # Usinng a dictionary term >> obj.set_attr_term("name", {"@id": "http://schema.org/givenName", "@type": "@id"}) Args: @@ -1847,7 +1749,9 @@ def set_attr_term( AssertionError: If the attribute is not found in the model """ - assert attr in self.model_fields, f"Attribute {attr} not found in {self.__class__.__name__}" + assert ( + attr in self.model_fields + ), f"Attribute {attr} not found in {self.__class__.__name__}" if prefix: validate_prefix(term, prefix) @@ -1856,10 +1760,7 @@ def set_attr_term( self.ld_context[attr] = term def add_type_term( - self, - term: str, - prefix: str | None = None, - iri: str | None = None + self, term: str, prefix: str | None = None, iri: str | None = None ): """Adds a term to the @type field of the JSON-LD object @@ -1888,10 +1789,9 @@ def add_type_term( class UnitDefinition(BaseModel): - - model_config: ConfigDict = ConfigDict( # type: ignore - validate_assigment = True, - ) # type: ignore + model_config: ConfigDict = ConfigDict( # type: ignore + validate_assigment=True, + ) # type: ignore id: Optional[str] = Field(default=None) name: Optional[str] = Field(default=None) @@ -1899,22 +1799,22 @@ class UnitDefinition(BaseModel): # JSON-LD fields ld_id: str = Field( - alias="@id", - default_factory=lambda: "enzml:UnitDefinition/" + str(uuid4()) + serialization_alias="@id", + default_factory=lambda: "enzml:UnitDefinition/" + str(uuid4()), ) ld_type: list[str] = Field( - alias="@type", - default_factory = lambda: [ + serialization_alias="@type", + default_factory=lambda: [ "enzml:UnitDefinition", ], ) ld_context: dict[str, str | dict] = Field( - alias="@context", - default_factory = lambda: { + serialization_alias="@context", + default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/", - } + }, ) def filter_base_units(self, **kwargs) -> list[BaseUnit]: @@ -1929,13 +1829,12 @@ def filter_base_units(self, **kwargs) -> list[BaseUnit]: return FilterWrapper[BaseUnit](self.base_units, **kwargs).filter() - def set_attr_term( self, attr: str, term: str | dict, prefix: str | None = None, - iri: str | None = None + iri: str | None = None, ): """Sets the term for a given attribute in the JSON-LD object @@ -1946,7 +1845,7 @@ def set_attr_term( # Using a prefix and term >> obj.set_attr_term("name", "schema:givenName", "schema", "http://schema.org") - # Using a dictionary term + # Usinng a dictionary term >> obj.set_attr_term("name", {"@id": "http://schema.org/givenName", "@type": "@id"}) Args: @@ -1957,7 +1856,9 @@ def set_attr_term( AssertionError: If the attribute is not found in the model """ - assert attr in self.model_fields, f"Attribute {attr} not found in {self.__class__.__name__}" + assert ( + attr in self.model_fields + ), f"Attribute {attr} not found in {self.__class__.__name__}" if prefix: validate_prefix(term, prefix) @@ -1966,10 +1867,7 @@ def set_attr_term( self.ld_context[attr] = term def add_type_term( - self, - term: str, - prefix: str | None = None, - iri: str | None = None + self, term: str, prefix: str | None = None, iri: str | None = None ): """Adds a term to the @type field of the JSON-LD object @@ -1996,36 +1894,33 @@ def add_type_term( add_namespace(self, prefix, iri) self.ld_type.append(term) - def add_to_base_units( self, kind: UnitType, exponent: int, - multiplier: Optional[float]= None, - scale: Optional[float]= None, + multiplier: Optional[float] = None, + scale: Optional[float] = None, **kwargs, ): params = { "kind": kind, "exponent": exponent, "multiplier": multiplier, - "scale": scale + "scale": scale, } if "id" in kwargs: params["id"] = kwargs["id"] - self.base_units.append( - BaseUnit(**params) - ) + self.base_units.append(BaseUnit(**params)) return self.base_units[-1] -class BaseUnit(BaseModel): - model_config: ConfigDict = ConfigDict( # type: ignore - validate_assigment = True, - ) # type: ignore +class BaseUnit(BaseModel): + model_config: ConfigDict = ConfigDict( # type: ignore + validate_assigment=True, + ) # type: ignore kind: UnitType exponent: int @@ -2034,31 +1929,30 @@ class BaseUnit(BaseModel): # JSON-LD fields ld_id: str = Field( - alias="@id", - default_factory=lambda: "enzml:BaseUnit/" + str(uuid4()) + serialization_alias="@id", + default_factory=lambda: "enzml:BaseUnit/" + str(uuid4()), ) ld_type: list[str] = Field( - alias="@type", - default_factory = lambda: [ + serialization_alias="@type", + default_factory=lambda: [ "enzml:BaseUnit", ], ) ld_context: dict[str, str | dict] = Field( - alias="@context", - default_factory = lambda: { + serialization_alias="@context", + default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/", - } + }, ) - def set_attr_term( self, attr: str, term: str | dict, prefix: str | None = None, - iri: str | None = None + iri: str | None = None, ): """Sets the term for a given attribute in the JSON-LD object @@ -2069,7 +1963,7 @@ def set_attr_term( # Using a prefix and term >> obj.set_attr_term("name", "schema:givenName", "schema", "http://schema.org") - # Using a dictionary term + # Usinng a dictionary term >> obj.set_attr_term("name", {"@id": "http://schema.org/givenName", "@type": "@id"}) Args: @@ -2080,7 +1974,9 @@ def set_attr_term( AssertionError: If the attribute is not found in the model """ - assert attr in self.model_fields, f"Attribute {attr} not found in {self.__class__.__name__}" + assert ( + attr in self.model_fields + ), f"Attribute {attr} not found in {self.__class__.__name__}" if prefix: validate_prefix(term, prefix) @@ -2089,10 +1985,7 @@ def set_attr_term( self.ld_context[attr] = term def add_type_term( - self, - term: str, - prefix: str | None = None, - iri: str | None = None + self, term: str, prefix: str | None = None, iri: str | None = None ): """Adds a term to the @type field of the JSON-LD object @@ -2121,10 +2014,9 @@ def add_type_term( class EqVariable(BaseModel): - - model_config: ConfigDict = ConfigDict( # type: ignore - validate_assigment = True, - ) # type: ignore + model_config: ConfigDict = ConfigDict( # type: ignore + validate_assigment=True, + ) # type: ignore id: str name: str @@ -2132,34 +2024,33 @@ class EqVariable(BaseModel): # JSON-LD fields ld_id: str = Field( - alias="@id", - default_factory=lambda: "enzml:EqVariable/" + str(uuid4()) + serialization_alias="@id", + default_factory=lambda: "enzml:EqVariable/" + str(uuid4()), ) ld_type: list[str] = Field( - alias="@type", - default_factory = lambda: [ + serialization_alias="@type", + default_factory=lambda: [ "enzml:EqVariable", ], ) ld_context: dict[str, str | dict] = Field( - alias="@context", - default_factory = lambda: { + serialization_alias="@context", + default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/", "id": { "@type": "@id", }, - } + }, ) - def set_attr_term( self, attr: str, term: str | dict, prefix: str | None = None, - iri: str | None = None + iri: str | None = None, ): """Sets the term for a given attribute in the JSON-LD object @@ -2170,7 +2061,7 @@ def set_attr_term( # Using a prefix and term >> obj.set_attr_term("name", "schema:givenName", "schema", "http://schema.org") - # Using a dictionary term + # Usinng a dictionary term >> obj.set_attr_term("name", {"@id": "http://schema.org/givenName", "@type": "@id"}) Args: @@ -2181,7 +2072,9 @@ def set_attr_term( AssertionError: If the attribute is not found in the model """ - assert attr in self.model_fields, f"Attribute {attr} not found in {self.__class__.__name__}" + assert ( + attr in self.model_fields + ), f"Attribute {attr} not found in {self.__class__.__name__}" if prefix: validate_prefix(term, prefix) @@ -2190,10 +2083,7 @@ def set_attr_term( self.ld_context[attr] = term def add_type_term( - self, - term: str, - prefix: str | None = None, - iri: str | None = None + self, term: str, prefix: str | None = None, iri: str | None = None ): """Adds a term to the @type field of the JSON-LD object @@ -2222,10 +2112,9 @@ def add_type_term( class EqParameter(BaseModel): - - model_config: ConfigDict = ConfigDict( # type: ignore - validate_assigment = True, - ) # type: ignore + model_config: ConfigDict = ConfigDict( # type: ignore + validate_assigment=True, + ) # type: ignore id: str name: str @@ -2234,34 +2123,33 @@ class EqParameter(BaseModel): # JSON-LD fields ld_id: str = Field( - alias="@id", - default_factory=lambda: "enzml:EqParameter/" + str(uuid4()) + serialization_alias="@id", + default_factory=lambda: "enzml:EqParameter/" + str(uuid4()), ) ld_type: list[str] = Field( - alias="@type", - default_factory = lambda: [ + serialization_alias="@type", + default_factory=lambda: [ "enzml:EqParameter", ], ) ld_context: dict[str, str | dict] = Field( - alias="@context", - default_factory = lambda: { + serialization_alias="@context", + default_factory=lambda: { "enzml": "http://www.enzymeml.org/v2/", "OBO": "http://purl.obolibrary.org/obo/", "schema": "https://schema.org/", "id": { "@type": "@id", }, - } + }, ) - def set_attr_term( self, attr: str, term: str | dict, prefix: str | None = None, - iri: str | None = None + iri: str | None = None, ): """Sets the term for a given attribute in the JSON-LD object @@ -2272,7 +2160,7 @@ def set_attr_term( # Using a prefix and term >> obj.set_attr_term("name", "schema:givenName", "schema", "http://schema.org") - # Using a dictionary term + # Usinng a dictionary term >> obj.set_attr_term("name", {"@id": "http://schema.org/givenName", "@type": "@id"}) Args: @@ -2283,7 +2171,9 @@ def set_attr_term( AssertionError: If the attribute is not found in the model """ - assert attr in self.model_fields, f"Attribute {attr} not found in {self.__class__.__name__}" + assert ( + attr in self.model_fields + ), f"Attribute {attr} not found in {self.__class__.__name__}" if prefix: validate_prefix(term, prefix) @@ -2292,10 +2182,7 @@ def set_attr_term( self.ld_context[attr] = term def add_type_term( - self, - term: str, - prefix: str | None = None, - iri: str | None = None + self, term: str, prefix: str | None = None, iri: str | None = None ): """Adds a term to the @type field of the JSON-LD object @@ -2331,12 +2218,14 @@ class DataTypes(Enum): FEED = "feed" PEAK_AREA = "peak-area" + class EquationType(Enum): ASSIGNMENT = "assignment" INITIAL_ASSIGNMENT = "initialAssignment" ODE = "ode" RATE_LAW = "rateLaw" + class UnitType(Enum): AMPERE = "ampere" AVOGADRO = "avogadro" @@ -2370,4 +2259,4 @@ class UnitType(Enum): TESLA = "tesla" VOLT = "volt" WATT = "watt" - WEBER = "weber" \ No newline at end of file + WEBER = "weber"