def _configure(self):
     predicate_range_file = self.config.get("predicate_range_mappings",
                                            None)
     if isinstance(predicate_range_file, dict):
         self.predicate_range_mappings = predicate_range_file
     elif predicate_range_file:
         self.predicate_range_mappings = load_json_file(
             predicate_range_file)
     else:
         self.predicate_range_mappings = {}
Beispiel #2
0
 def _configure(self):
     file = self.config["root_info"]
     if isinstance(file, dict):
         self.root_info = file
     else:
         self.root_info = load_json_file(file)
     self.root_type = self.root_info["root_type"]  # "ad"
     self.root_predicates = self.root_info[
         "root_predicates"]  # [price, name, blah]
     self.inverse_predicates = self.root_info[
         "inverse_predicates"]  # {cluster: ad}
     return
 def _configure(self):
     filename = "__constraint_type_transformations"
     file = self.config["constraint_type_transformations"]
     if isinstance(file, dict):
         self.constraint_type_transformations_to_compile = file
     else:
         self.constraint_type_transformations_to_compile = load_json_file(
             file)
     self.constraint_type_transformations = {}
     self.constraint_type_transformations["owl:Thing"] = compile(
         "value", filename, 'eval')
     for key, value in self.constraint_type_transformations_to_compile.items(
     ):
         compiled_transformation = compile(value, filename, 'eval')
         self.constraint_type_transformations[key] = compiled_transformation
 def _configure(self):
     file = self.config["type_query_mappings"]
     if isinstance(file, dict):
         self.type_query_mapping = file
     else:
         self.type_query_mapping = load_json_file(file)
 def _configure(self):
     file = self.config["field_weight_mappings"]
     if isinstance(file, dict):
         self.field_weight_mapping = file
     else:
         self.field_weight_mapping = load_json_file(file)
Beispiel #6
0
                      "--shards",
                      action="store",
                      type="string",
                      dest="shards",
                      default="5")
    (c_options, args) = parser.parse_args()

    config_file = c_options.config
    properties_file = c_options.properties
    output_file = c_options.output
    default_mapping_file = c_options.default_mapping
    url = c_options.url
    etk = c_options.etk
    shards = c_options.shards
    if properties_file:
        properties = load_json_file(properties_file)
    else:
        properties = {}
    if not url and config_file:
        config = load_json_file(config_file)
    elif url:
        parsed_url = urlparse(url)
        if parsed_url.username:
            response = requests.get(url,
                                    auth=(parsed_url.username,
                                          parsed_url.password))
        else:
            response = requests.get(url)
        config = response.json()

    default_mapping = None