Exemple #1
0
    def _normalize_inherited_property(self, property_name):
        for table in self.metadata['tables']:
            property_value = self.metadata.get(property_name, None)
            property_value = table.get(property_name, property_value)
            property_value = table['tableSchema'].get(property_name, property_value)

            if property_value is not None:
                for column in table['tableSchema']['columns']:
                    if property_name not in column:
                        column[property_name] = property_value
                    if property_name in self._uri_template_properties:
                        column[property_name] = UriTemplateUtils.expand(column[property_name], table['url'])
Exemple #2
0
    def create_namespace(property_url, domain_url=''):
        property_url = UriTemplateUtils.expand(property_url, domain_url)
        if ':' in property_url and '://' not in property_url:
            prefix, term = property_url.split(':')
            return Namespaces.get(prefix)
        if '{' not in property_url:
            return Namespace(property_url)

        property_key = property_url[property_url.find('{') +
                                    1:property_url.find('}')]
        prefix = ''
        if property_key.startswith('#'):
            property_key = property_key[1:]
            property_url = property_url.replace('#', '')
            prefix = '#'
        if property_key == '_name':
            namespace_url = property_url.replace('{_name}', prefix)
            return Namespace(namespace_url)