def install(path_to_source_data_dir=None):
    print("IN TEST SETUP INSTALL")
    print(settings.DATABASES)
    #truncate_db()  # Done this step within the test_runner.py
    print("DATABASE TRUNCATED")
    load_eamena_extra_sql()
    print("EXTRA SQL LOADED")
    delete_index(index='concept_labels')
    delete_index(index='term')
    Resource().prepare_term_index(create=True)

    load_resource_graphs()
    load_authority_files(path_to_source_data_dir)
    load_map_layers()

    resource_remover.truncate_resources()
    delete_index(index='resource')
    delete_index(index='entity')
    delete_index(index='maplayers')
    delete_index(index='resource_relations')
    create_indexes()

    load_resources()

    call_skos()
Ejemplo n.º 2
0
def install(path_to_source_data_dir=None):
    #truncate_db()

    execute_sql("Truncate ontology.mappings Cascade;")
    execute_sql("Truncate public.auth_permission Cascade;")

    for concept in models.Concepts.objects.filter(nodetype='Concept'):
        concept.delete()

    delete_index(index='concept_labels')
    delete_index(index='term')
    Resource().prepare_term_index(create=True)

    load_resource_graphs()
    load_authority_files(path_to_source_data_dir)
    load_map_layers()

    resource_remover.truncate_resources()
    delete_index(index='resource')
    delete_index(index='entity')
    delete_index(index='maplayers')
    delete_index(index='resource_relations')
    create_indexes()

    load_resources()
Ejemplo n.º 3
0
def install(path_to_source_data_dir=None):
    # truncate_db()

    execute_sql("Truncate ontology.mappings Cascade;")
    execute_sql("Truncate public.auth_permission Cascade;")

    for concept in models.Concepts.objects.filter(nodetype="Concept"):
        concept.delete()

    delete_index(index="concept_labels")
    delete_index(index="term")
    Resource().prepare_term_index(create=True)

    load_resource_graphs()
    load_authority_files(path_to_source_data_dir)
    load_map_layers()

    resource_remover.truncate_resources()
    delete_index(index="resource")
    delete_index(index="entity")
    delete_index(index="maplayers")
    delete_index(index="resource_relations")
    create_indexes()

    load_resources()
Ejemplo n.º 4
0
    def remove_resources(self, load_id = None):
        """
        Runs the resource_remover command found in package_utils

        """
        if load_id == None:
            resource_remover.truncate_resources()
        else: 
            resource_remover.delete_resources(load_id)
Ejemplo n.º 5
0
def install_arches_hip(path_to_source_data_dir=None):
    print "truncate_db"
    setup.truncate_db()
    # Resource().prepare_term_index(create=True)
    print "load_graphs"
    load_graphs()
    print "load_authority_files"
    setup.load_authority_files(path_to_source_data_dir)
    print "load_map_layers"
    setup.load_map_layers()

    # setup.create_indexes()
    resource_remover.truncate_resources()
    print "load_resources"
    setup.load_resources()
Ejemplo n.º 6
0
def install(path_to_source_data_dir=None):
    truncate_db()
    
    delete_index(index='concept_labels')
    delete_index(index='term') 
    Resource().prepare_term_index(create=True)

    load_resource_graphs()
    load_authority_files(path_to_source_data_dir)
    load_map_layers()

    resource_remover.truncate_resources()
    delete_index(index='resource')
    delete_index(index='entity')
    delete_index(index='maplayers')
    delete_index(index='resource_relations') 
    create_indexes()   

    load_resources()
Ejemplo n.º 7
0
def install(path_to_source_data_dir=None):
    truncate_db()
    
    delete_index(index='concept_labels')
    delete_index(index='term') 
    Resource().prepare_term_index(create=True)

    load_resource_graphs()
    load_authority_files(path_to_source_data_dir)
    load_map_layers()

    resource_remover.truncate_resources()
    delete_index(index='resource')
    delete_index(index='entity')
    delete_index(index='maplayers')
    delete_index(index='resource_relations') 
    create_indexes()   

    load_resources()
Ejemplo n.º 8
0
    def remove_resources(self,
                         load_id=None,
                         user_id=None,
                         csvpath=None,
                         force=False):
        """
        Runs the resource_remover command found in package_utils

        """
        if load_id is None and user_id is None and csvpath is None:
            if not force:
                remove = raw_input("You are about to remove ALL resources from your database."\
                        " Do you want to continue? y/N  > ")
                if remove.lower() != "y":
                    exit()
            print "removing all resources from database..."
            resource_remover.truncate_resources()
            print "    done."
            exit()

        if load_id is not None:
            resources = resource_remover.get_resourceids_from_edit_log(
                load_id=load_id)
        elif user_id is not None:
            resources = resource_remover.get_resourceids_from_edit_log(
                user_id=user_id)
        elif csvpath:
            resources = resource_remover.get_resourceids_from_csv(data_source)

        if not force:
            remove = raw_input("You are about to remove {} resources from your database."\
                    " Do you want to continue? y/N  > ".format(len(resources)))
            if remove.lower() != "y":
                exit()
        print "removing {} resources from database...".format(len(resources))
        resource_remover.delete_resource_list(resources)
        print "    done."