Пример #1
0
 def tordf(attrname):
     prefix, predicate = attrname.split('_', 1)
     ns = get_namespace_url(prefix)
     try:
         return ns[predicate]
     except:
         return None
Пример #2
0
 def to_rdf(attr_name):
     prefix, predicate = attr_name.rsplit('_', 1)
     ns = get_namespace_url(prefix)
     try:
         return ns[predicate]
     except:
         return None
Пример #3
0
    def bind_namespaces(self, *namespaces):
        """ Bind the `namespace` to the `resource`.

        Useful for pretty serialization of the resource.

        """

        for ns in namespaces:
            if isinstance(ns, str):
                self.__namespaces[ns] = get_namespace_url(ns)
            elif isinstance(ns, (Namespace, ClosedNamespace)):
                self.__namespaces[get_prefix(ns)] = ns
Пример #4
0
    def bind_namespaces(self, *namespaces):
        """ Bind the `namespace` to the `resource`.

        Useful for pretty serialization of the resource.

        """

        for ns in namespaces:
            if type(ns) in [str, unicode]:
                self.__namespaces[ns] = get_namespace_url(ns)
            elif type(ns) in [Namespace, ClosedNamespace]:
                self.__namespaces[get_prefix(ns)] = ns
Пример #5
0
    def bind_namespaces(self, *namespaces):
        """ Bind the `namespace` to the `resource`.

        Useful for pretty serialization of the resource.

        """

        for ns in namespaces:
            if type(ns) in [str, unicode]:
                self.__namespaces[ns] = get_namespace_url(ns)
            elif type(ns) in [Namespace, ClosedNamespace]:
                self.__namespaces[get_prefix(ns)] = ns