def update_mapping(self, header, class_, mappingName): self.init_mappings_only() mapping = self.get_mapping_by_name(mappingName) new_mapping = copy(mapping) new_mapping['class'] = class_['value'] for num, item in enumerate(header): key = "col" + str(num + 1) if(item['uri'] == ''): new_mapping[key] = item['label'] else: new_mapping[key] = item['uri'] if('datatype' in item and item['datatype'] != ''): new_mapping[key] = "%s^^%s"%(new_mapping[key], item['datatype']['uri']) wikified_mapping = self.convert_mapping_to_wiki_template(new_mapping) #delete mapping mapping_start = self.mappings_start[mappingName] mapping_end = self.mappings_end[mappingName] self.delete_template_from_wiki_page(mapping_start, mapping_end) self.add_mapping_to_wiki_page(wikified_mapping) self.wiki_page = self.remove_blank_lines_from_wiki_page(self.wiki_page) self.create_wiki_page(self.wiki_page) self.updateMetadata(self.resourceId, mappingName) #fire_up the conversion process for this mapping sparqlify = csv2rdf.tabular.sparqlify.Sparqlify(self.resource_id) sparqlify.addResourceToProcessingQueue(mappingName)
def transform_one(self, *args, **kw): cherrypy.response.headers["Access-Control-Allow-Origin"] = "*" cherrypy.response.headers["Access-Control-Allow-Methods"] = "GET, POST, OPTIONS" cherrypy.response.headers[ "Access-Control-Allow-Headers" ] = "Cache-Control, X-Proxy-Authorization, X-Requested-With" cherrypy.response.headers["Accept"] = "application/json" json_load = " ".join(cherrypy.request.params.keys()) json_load = json.loads(json_load) resourceId = json_load["resourceId"] resourceId = resourceId.lower() mappingName = json_load["mappingName"] sparqlify = Sparqlify(resourceId) status = sparqlify.addResourceToProcessingQueue(mappingName) return str(status)
def transform_all_related(self, *args, **kw): cherrypy.response.headers["Access-Control-Allow-Origin"] = "*" cherrypy.response.headers["Access-Control-Allow-Methods"] = "GET, POST, OPTIONS" cherrypy.response.headers[ "Access-Control-Allow-Headers" ] = "Cache-Control, X-Proxy-Authorization, X-Requested-With" cherrypy.response.headers["Accept"] = "application/json" json_load = " ".join(cherrypy.request.params.keys()) json_load = json.loads(json_load) resourceIds = json_load["resourceIds"] primaryResourceId = json_load["primaryResourceId"] mappingName = json_load["mappingName"] sparqlify = Sparqlify("") for resourceId in resourceIds: status = sparqlify.addResourceToProcessingQueue( mappingName, resourceId=resourceId, mappingResourceId=primaryResourceId ) return "True"