def __get_all_types(instance, server):
    all_types = set([])
    retries = 0
    while True:
        try:
            types = server.get_types(instance)
            for type in types:
                if type not in all_types:
                    current = server.get_all_class_parents(type)
                    current.append(type)
                    all_types |= set(current)
        except SparqlConnectionError as e:
            if retries == 0:
                log.warn("Error on query for: " + str(instance) + "\n" +
                         str(e) + "\n")
            retries += 1
            log.debug("Error on: " + str(instance) + " - try number: " +
                      str(retries) + "\n" + str(e) + "\n")
            if retries > 5:
                break
        else:
            if retries > 0:
                log.info("Success on retry for:" + str(instance) + "\n")
            break
    return all_types
def __get_all_parents(rdf_type, server):
    parents = []
    retries = 0
    while True:
        try:
            parents = server.get_all_class_parents(rdf_type)
        except SparqlConnectionError as e:
            if retries == 0:
                log.warn("Error on query for: " + str(rdf_type) + "\n" + str(e) + "\n")
            retries += 1
            log.debug("Error on: " + str(rdf_type) + " - try number: " + str(retries) + "\n" + str(e) + "\n")
            if retries > 5:
                break
        else:
            if retries > 0:
                log.info("Success on retry for:" + str(rdf_type) + "\n")
            break
    return parents
Beispiel #3
0
def __get_all_parents(rdf_type, server):
    parents = []
    retries = 0
    while True:
        try:
            parents = server.get_all_class_parents(rdf_type)
        except SparqlConnectionError as e:
            if retries == 0:
                log.warn("Error on query for: " + str(rdf_type) + "\n" +
                         str(e) + "\n")
            retries += 1
            log.debug("Error on: " + str(rdf_type) + " - try number: " +
                      str(retries) + "\n" + str(e) + "\n")
            if retries > 5:
                break
        else:
            if retries > 0:
                log.info("Success on retry for:" + str(rdf_type) + "\n")
            break
    return parents
def __get_all_types(instance, server):
    all_types = set([])
    retries = 0
    while True:
        try:
            types = server.get_types(instance)
            for type in types:
                if type not in all_types:
                    current = server.get_all_class_parents(type)
                    current.append(type)
                    all_types |= set(current)
        except SparqlConnectionError as e:
            if retries == 0:
                log.warn("Error on query for: " + str(instance) + "\n" + str(e) + "\n")
            retries += 1
            log.debug("Error on: " + str(instance) + " - try number: " + str(retries) + "\n" + str(e) + "\n")
            if retries > 5:
                break
        else:
            if retries > 0:
                log.info("Success on retry for:" + str(instance) + "\n")
            break
    return all_types