Skip to content

triplestoreconfig

Pydantic TripleStore Configuration Data Model.

TripleStoreConfig

Bases: GenericConfig, SecretConfig

TripleStore Configuration.

This is a configuration for the TripleStore.

This class should not be used directly as a configuration object for a strategy object, but only as a configuration field inside a configuration object.

Source code in oteapi/models/triplestoreconfig.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
class TripleStoreConfig(GenericConfig, SecretConfig):
    """TripleStore Configuration.

    This is a configuration for the
    [`TripleStore`][oteapi.triplestore.triplestore.TripleStore].

    This class should not be used directly as a configuration object
    for a strategy object, but only as a configuration field inside
    a configuration object.
    """

    repositoryName: str = Field(
        ..., description="The repository name, where the mappings are stored."
    )
    agraphHost: str = Field(
        ...,
        description="AllegroGraph host name.",
    )
    agraphPort: int = Field(
        ...,
        description="AllegroGraph port number.",
    )

    @root_validator
    def ensure_user_pass(cls, values: "Dict[str, Any]") -> "Dict[str, Any]":
        """Ensure that user/password are set, since they are optional in the SecretConfig."""
        if not all(values.get(_) for _ in ["user", "password"]):
            raise ValueError("User and password must be defined.")
        return values

    class Config:
        """Pydantic configuration for TripleStoreConfig."""

        fields = {
            "token": {"exclude": True},
            "client_id": {"exclude": True},
            "client_secret": {"exclude": True},
        }
        """The `fields`-config enables that `token`, `client_id` and `client_secret`
        will be excluded, when the model is serialized."""

agraphHost: str = Field(Ellipsis, description='AllegroGraph host name.') class-attribute

agraphPort: int = Field(Ellipsis, description='AllegroGraph port number.') class-attribute

repositoryName: str = Field(Ellipsis, description='The repository name, where the mappings are stored.') class-attribute

Config

Pydantic configuration for TripleStoreConfig.

Source code in oteapi/models/triplestoreconfig.py
43
44
45
46
47
48
49
50
51
52
class Config:
    """Pydantic configuration for TripleStoreConfig."""

    fields = {
        "token": {"exclude": True},
        "client_id": {"exclude": True},
        "client_secret": {"exclude": True},
    }
    """The `fields`-config enables that `token`, `client_id` and `client_secret`
    will be excluded, when the model is serialized."""

fields = {'token': {'exclude': True}, 'client_id': {'exclude': True}, 'client_secret': {'exclude': True}} class-attribute

The fields-config enables that token, client_id and client_secret will be excluded, when the model is serialized.

ensure_user_pass(values)

Ensure that user/password are set, since they are optional in the SecretConfig.

Source code in oteapi/models/triplestoreconfig.py
36
37
38
39
40
41
@root_validator
def ensure_user_pass(cls, values: "Dict[str, Any]") -> "Dict[str, Any]":
    """Ensure that user/password are set, since they are optional in the SecretConfig."""
    if not all(values.get(_) for _ in ["user", "password"]):
        raise ValueError("User and password must be defined.")
    return values