Пример #1
0
 def set_location(self, lat, lon):
     Validation.location_check(lat, lon)
     # should only have one location, so delete old lat/lon first
     self.delete_location()
     subj = self._get_uuid_uriref()
     self._graph.add(
         (subj, GEO_NS.lat, Literal('%s' % lat, datatype=XSD.float)))
     self._graph.add(
         (subj, GEO_NS.long, Literal('%s' % lon, datatype=XSD.float)))
Пример #2
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)))
Пример #3
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))