Пример #1
0
def process_csv(file_name, graph):
    logging.info("Processing file: %s", file_name)
    with open(file_name) as csvfile:
        readCSV = csv.reader(csvfile, delimiter=',')
        for row in readCSV:
            service_name = row[0].replace("/api/", "")
            # service_name = row[0].replace("/mashup/", "")
            logging.info("Processing service %s", service_name)
            date = row[1]
            if not service_is_in_graph(service_name, graph):
                try:
                    entity = Entity.factory("Service", service_name)
                    # entity = Entity.factory("Mashup", service_name)
                    graph = entity.tordf(graph)
                    e.add_attachment_to_dataset(entity, graph)
                    e.add_creation_date(entity, date, graph)
                except:
                    logging.error("Something wrong with the service %s", service_name, exc_info=True)
            else:
                logging.info("Service %s is already in a graph", service_name)
    return graph
Пример #2
0
def process_csv(file_name, graph):
    logging.info("Processing file: %s", file_name)
    with open(file_name) as csvfile:
        readCSV = csv.reader(csvfile, delimiter=',')
        for row in readCSV:
            service_name = row[0].replace("/api/", "")
            # service_name = row[0].replace("/mashup/", "")
            logging.info("Processing service %s", service_name)
            date = row[1]
            if not service_is_in_graph(service_name, graph):
                try:
                    entity = Entity.factory("Service", service_name)
                    # entity = Entity.factory("Mashup", service_name)
                    graph = entity.tordf(graph)
                    e.add_attachment_to_dataset(entity, graph)
                    e.add_creation_date(entity, date, graph)
                except:
                    logging.error("Something wrong with the service %s",
                                  service_name,
                                  exc_info=True)
            else:
                logging.info("Service %s is already in a graph", service_name)
    return graph
Пример #3
0
def test():
    g = Graph()
    entity = Entity.factory("Service", "google-maps")
    g = entity.tordf(g)
    g.serialize(destination="test.ttl", format='turtle')
Пример #4
0
def test():
    g = Graph()
    entity = Entity.factory("Service", "google-maps")
    g = entity.tordf(g)
    g.serialize(destination="test.ttl", format='turtle')