コード例 #1
0
    def delete_description(self, lang=None):
        """Deletes all the `label` metadata properties on your Thing/Point for this language

        Raises `ValueError` containing an error message if the parameters fail validation

        `lang` (optional) (string) The two-character ISO 639-1 language code to use for your label.
        None means use the default language for your agent.
        See [Config](./Config.m.html#IoticAgent.IOT.Config.Config.__init__)
        """
        self._remove_properties_by_language(RDFS.comment,
                                            Validation.lang_check_convert(lang, default=self._default_lang))
コード例 #2
0
    def delete_description(self, lang=None):
        """
        Deletes all the `label` metadata properties on your Thing/Point for this language

        Raises:
            ValueError: Contains an error message if the parameters fail validation

        Args:
            lang (string, optional): The two-character ISO 639-1 language code to identify your label. None means use
                the default language for your agent. See :doc:`IoticAgent.IOT.Config`
        """
        self._remove_properties_by_language(
            self._commentPredicate,
            Validation.lang_check_convert(lang, default=self._default_lang))
コード例 #3
0
    def set_description(self, description, lang=None):
        """Sets the `description` metadata property on your Thing/Point.  Only one description is allowed per language,
        so any other descriptions in this language are removed before adding this one

        Raises `ValueError` containing an error message if the parameters fail validation

        `description` (mandatory) (string) the new text of the description

        `lang` (optional) (string) The two-character ISO 639-1 language code to use for your label.
        None means use the default language for your agent.
        See [Config](./Config.m.html#IoticAgent.IOT.Config.Config.__init__)
        """
        description = Validation.description_check_convert(description)
        lang = Validation.lang_check_convert(lang, default=self._default_lang)
        # remove any other descriptions (AKA RDFS.comment s) with this language before adding
        self.delete_description(lang)
        subj = self._get_uuid_uriref()
        self._graph.add((subj, RDFS.comment, Literal(description, lang)))
コード例 #4
0
    def set_label(self, label, lang=None):
        """
        Sets the `label` metadata property on your Thing/Point.  Only one label is allowed per language, so any
        other labels in this language are removed before adding this one

        Raises:
            ValueError: Contains an error message if the parameters fail validation

        Args:
            label (string): the new text of the label
            lang (string, optional): The two-character ISO 639-1 language code to use for your label. None means use
                the default language for your agent. See :doc:`IoticAgent.IOT.Config`.
        """
        label = Validation.label_check_convert(label)
        lang = Validation.lang_check_convert(lang, default=self._default_lang)
        # remove any other labels with this language before adding
        self.delete_label(lang)
        subj = self._get_uuid_uriref()
        self._graph.add((subj, self._labelPredicate, Literal(label, lang)))