Skip to content

Instantly share code, notes, and snippets.

View joernhees's full-sized avatar

Jörn Hees joernhees

View GitHub Profile
@gromgull
gromgull / sparql_generator.py
Last active November 15, 2017 13:49
RDFLib SPARQLGenerator
from __future__ import unicode_literals
from collections import defaultdict
from io import StringIO
from rdflib import URIRef, Literal, Variable
def unroll(triples, vars=None):
"""
Convert list of tuples specifying triples with repeat subjects or