create rdf graph using rdflib from yago 40k dataset

53 views Asked by At

I have yago triple dataset splited into train ,test and valid which is format txt.when i tried to serialised it into rdf graph , I got error.

so this is the code :

from rdflib import Graph, URIRef

graph=Graph()

# Read the FB15k dataset file
with open("train.txt", "r") as file:
    for line in file:
        parts = line.strip().split()
        if len(parts) == 3:
            entity1, relation, entity2 = parts

            # Define URIs for entities and relation
            entity1_uri = URIRef(f"{entity1}")
            entity2_uri = URIRef(f"{entity2}")
            relation_uri = URIRef(f"{relation}")

            # Add the triple to the graph
            graph.add((entity1_uri, relation_uri, entity2_uri))
with open("test.txt", "r") as file:
    for line in file:
        parts = line.strip().split()
        if len(parts) == 3:
            entity1, relation, entity2 = parts

            # Define URIs for entities and relation
            entity1_uri = URIRef(f"{entity1}")
            entity2_uri = URIRef(f"{entity2}")
            relation_uri = URIRef(f"{relation}")

            # Add the triple to the graph
            graph.add((entity1_uri, relation_uri, entity2_uri))

with open("valid.txt", "r") as file:
    for line in file:
        parts = line.strip().split()
        if len(parts) == 3:
            entity1, relation, entity2 = parts

            # Define URIs for entities and relation
            entity1_uri = URIRef(f"{entity1}")
            entity2_uri = URIRef(f"{entity2}")
            relation_uri = URIRef(f"{relation}")

            # Add the triple to the graph
            graph.add((entity1_uri, relation_uri, entity2_uri))

I got these wornings


output
WARNING:rdflib.term:Robert_John_\u0022Mutt\u0022_Lange does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:\u0022Weird_Al\u0022_Yankovic does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:\u0022Weird_Al\u0022_Yankovic does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Albrook_\u0022Marcos_A._Gelabert\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Robert_John_\u0022Mutt\u0022_Lange does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Robert_John_\u0022Mutt\u0022_Lange does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:\u0022Weird_Al\u0022_Yankovic does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Albrook_\u0022Marcos_A._Gelabert\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:\u0022Weird_Al\u0022_Yankovic does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Albrook_\u0022Marcos_A._Gelabert\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Albrook_\u0022Marcos_A._Gelabert\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:\u0022Weird_Al\u0022_Yankovic does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Albrook_\u0022Marcos_A._Gelabert\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Albrook_\u0022Marcos_A._Gelabert\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Robert_John_\u0022Mutt\u0022_Lange does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:\u0022Weird_Al\u0022_Yankovic does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:\u0022Weird_Al\u0022_Yankovic does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Albrook_\u0022Marcos_A._Gelabert\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Robert_John_\u0022Mutt\u0022_Lange does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Robert_John_\u0022Mutt\u0022_Lange does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:\u0022Weird_Al\u0022_Yankovic does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Albrook_\u0022Marcos_A._Gelabert\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:\u0022Weird_Al\u0022_Yankovic does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Albrook_\u0022Marcos_A._Gelabert\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Albrook_\u0022Marcos_A._Gelabert\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:\u0022Weird_Al\u0022_Yankovic does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Albrook_\u0022Marcos_A._Gelabert\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Albrook_\u0022Marcos_A._Gelabert\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Robert_John_\u0022Mutt\u0022_Lange does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:\u0022Weird_Al\u0022_Yankovic does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:\u0022Weird_Al\u0022_Yankovic does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Albrook_\u0022Marcos_A._Gelabert\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Robert_John_\u0022Mutt\u0022_Lange does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Robert_John_\u0022Mutt\u0022_Lange does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:\u0022Weird_Al\u0022_Yankovic does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Albrook_\u0022Marcos_A._Gelabert\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:\u0022Weird_Al\u0022_Yankovic does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Albrook_\u0022Marcos_A._Gelabert\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Albrook_\u0022Marcos_A._Gelabert\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:\u0022Weird_Al\u0022_Yankovic does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Albrook_\u0022Marcos_A._Gelabert\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Albrook_\u0022Marcos_A._Gelabert\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport does not look like a valid URI, trying to serialize this will break.
WARNING:rdflib.term:Skopje_\u0022Alexander_the_Great\u0022_Airport does not look like a valid URI, trying to serialize this will break.

And when I tried to serialize the graph :

# Serialize the RDF graph to Turtle format
graph.serialize("yago40k.rdf", format="nt")

I got this error :

Exception                                 Traceback (most recent call last)
<ipython-input-6-a1aaa24d5ccd> in <cell line: 2>()
      1 # Serialize the RDF graph to Turtle format
----> 2 graph.serialize("yago40k.rdf", format="nt")

3 frames
/usr/local/lib/python3.10/dist-packages/rdflib/term.py in n3(self, namespace_manager)
    308 
    309         if not _is_valid_uri(self):
--> 310             raise Exception(
    311                 '"%s" does not look like a valid URI, I cannot serialize this as N3/Turtle. Perhaps you wanted to urlencode it?'
    312                 % self

Exception: "Del_Caribe_\u0022Santiago_Mariño\u0022_International_Airport" does not look like a valid URI, I cannot serialize this as N3/Turtle. Perhaps you wanted to urlencode it?

So, could any one help me? I have to convert this dataset to rdf graph.

0

There are 0 answers