Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add add_class() method to triplestore #24

Open
jesper-friis opened this issue Oct 23, 2022 · 0 comments
Open

Add add_class() method to triplestore #24

jesper-friis opened this issue Oct 23, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@jesper-friis
Copy link
Contributor

jesper-friis commented Oct 23, 2022

Make it easy to add a new class to the triplestore, including annotations, subClassOf, equivalentTo, and disjointWith relations.
It could be defined something like

    def add_class(
            self,
            iri: str,
            subclass_of: "Sequence[str]" = None,
            annotations: dict = None,
            equivalent_to: "Sequence[str]" = None,
            disjoint_with: "Sequence[str]" = None
    ) -> str:
        """Add new class to the triplestore.
    
        Arguments:
            iri: IRI of the new class.  See notes below for how include
                template substitution of a unique reproducible generated
                hash.
            subclass_of: A sequence of strings with superclass IRIs or
                restrictions. Restrictions should use Manchester syntax
                (require [EMMOntoPy]).
            annotations: A dict mapping annotation IRIs to values.
                Use Literal for literal annotation values.
            equivalent_to: A sequence of strings with logical constructs
                that this class is equivalent to using Manchester syntax
                (require [EMMOntoPy]).
            disjoint_with: A sequence of strings with logical constructs
                that this class is disjoint with using Manchester syntax
                (require [EMMOntoPy]).
                    
        Returns:
            The `iri` after template substitution.

        Notes:
            The `iri` argument may contain a template substring of the
            form

                {ID:TYPE.LENGTH}

            which will be substituted with a unique but reproducible
            hash of `ID` and the triplestore `base_iri`, where `ID` is
            a unique user-provided identifier string for this class.
            The ":TYPE" (defaults to "uuid") and ".LENGTH" parts are
            optional.

            `TYPE` specifies how the hash is calculated and encoded
            and should be one of "uuid", "hex" or "base64". The "uuid"
            type correspond to a version 5 UUID (using the URL
            namespace), while the "hex" and "base64" types correspond
            to a hash generated with `urllib.shake_128()` encoded as
            hexidecimal or base64, respectively.
    
            If `LENGTH` is given, it specifies the number of
            substituted characters for the "hex" and "base64" types.

            For example, an IRI for EMMO would be `EMMO["EMMO_{uuid}"]`,
            where `EMMO` is a namespace.

        References:
            [EMMOntoPy]: https://pypi.org/project/EMMOntoPy/
        """

Also, add issues similar methods

add_annotation(self, iri: str, annotations: dict = None, subproperty_of: "Sequence[str]" = None, domains: "Sequence[str]" = None, ranges: "Sequence[str]" = None, equivalent_to: "Sequence[str]" = None) -> str

add_object_property(self, iri: str, annotations: dict = None, subproperty_of: "Sequence[str]" = None, domains: "Sequence[str]" = None, ranges: "Sequence[str]" = None, characteristics: "Sequence[str]" = None, equivalent_to: "Sequence[str]" = None, disjoint_with: "Sequence[str]" = None, inverse_of: "Sequence[str]" = None) -> str 

add_data_property(self, iri: str, annotations: dict = None, subproperty_of: "Sequence[str]" = None, domains: "Sequence[str]" = None, ranges: "Sequence[str]" = None, characteristics: "Sequence[str]" = None, equivalent_to: "Sequence[str]" = None, disjoint_with: "Sequence[str]" = None) -> str 

add_individual(self, iri: str, annotations: dict = None, types: "Sequence[str]" = None, same_as: "Sequence[str]" = None, different_from: "Sequence[str]" = None, object_properties: "Sequence[str]" = None, data_properties: "Sequence[str]" = None, neg_object_properties: "Sequence[str]" = None, neg_data_properties: "Sequence[str]" = None) -> str 
@jesper-friis jesper-friis added the enhancement New feature or request label Oct 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant