Exemple #1
0
L = []
M = []
T = []
for z in range(len(relations)):
    A = relations[z]
    FOAF.name = rdflib.term.URIRef(u'http://xmlns.com/foaf/0.1/' + A[1])
    T.append(FOAF.name)
    n = Namespace("http://example.org/TrackID/")
    n1 = Namespace("http://example.org/Duration/")
    a = [row[A[0]] for row in values]
    b = [row[A[2]] for row in values]

    for i in range(len(a)):
        temp1 = a[i]
        temp2 = b[i]
        n.temp1 = rdflib.term.URIRef(u'http://example.org/TrackID/' + a[i])
        n1.temp2 = rdflib.term.URIRef(u'http://example.org/Duration/' + b[i])
        t1 = n.temp1
        t2 = n1.temp2
        L.append(t1)
        M.append(t2)

g = Graph()

count = -1
for i in range(len(L)):
    if i % 228159 == 0:
        count = count + 1
    typ = T[count]
    g.add((L[i], typ, M[i]))