code: def sparql(self, select='*', body=None, inject_prefixes=None, single_column=False):
          
          if inject_prefixes is None:
              inject_prefixes = []
          namedGraph = get_named_graph(self.handle)
          cols = []
          select_val = None
          if select is None or select=='*':
              if not single_column:
                  cols=None
              select_val='*'
          else:
              if isinstance(cols,list):
                  cols = [select]
              else:
                  cols = select
              select_val = ", ".join(['?'+c for c in cols])
  
          prefixes = ""
          if inject_prefixes is not None:
              plist = ["prefix {}: <{}> ".format(p,expand_uri(p+":")) for p in inject_prefixes if p != "" and p is not None]
              prefixes = "\n".join(plist)
          query = """
          {prefixes}
          SELECT {s} WHERE {{
          GRAPH <{g}>  {{
          {b}
          }}
          }}
          """.format(prefixes=prefixes, s=select_val, b=body, g=namedGraph)
          bindings = run_sparql(query)
          if len(bindings) == 0:
              return []
          if cols is None:
              return bindings
          else:
              if single_column:
                  c = list(bindings[0].keys())[0]
                  return [r[c]['value'] for r in bindings]
              else:
                  return [r[c]['value'] for c in cols for r in bindings]
docs: Execute a SPARQL query.
  
          The query is specified using `select` and `body` parameters.
          The argument for the Named Graph is injected into the query.
  
          The select parameter should be either '*' or a list of vars (not prefixed with '?').
  
           - If '*' is passed, then the result is a list of dicts, { $var: {value: $val } }
           - If a list of vars is passed, then the result is a list of lists
           - Unless single_column=True, in which case the results are a simple list of values from the first var
  
          The inject_prefixes argument can be used to inject a list of prefixes - these are expanded
          using the prefixcommons library