<s> __author__ = '<STR_LIT>' <EOL> import os <EOL> import StringIO <EOL> import rdflib <EOL> import pandas as pd <EOL> class AttrDict ( dict ) : <EOL> def __init__ ( self , * args , ** kwargs ) : <EOL> super ( AttrDict , self ) . __init__ ( * args , ** kwargs ) <EOL> self . __dict__ = self <EOL> NS = AttrDict ( iri = rdflib . Namespace ( "<STR_LIT>" ) , <EOL> nidm = rdflib . Namespace ( "<STR_LIT>" ) , <EOL> niq = rdflib . Namespace ( "<STR_LIT>" ) , <EOL> rq = rdflib . Namespace ( "<STR_LIT>" ) , <EOL> prov = rdflib . Namespace ( "<STR_LIT>" ) ) <EOL> _sparql_path = os . path . join ( os . path . abspath ( os . path . dirname ( __file__ ) ) , <EOL> '<STR_LIT>' ) <EOL> def get_meta_path ( ) : <EOL> return os . path . join ( _sparql_path , '<STR_LIT>' ) <EOL> def get_sparql_queries ( ) : <EOL> """<STR_LIT>""" <EOL> queries = dict ( ) <EOL> for rq_file in os . listdir ( _sparql_path ) : <EOL> if not rq_file . endswith ( '<STR_LIT>' ) : <EOL> rq_path = os . path . join ( _sparql_path , rq_file ) <EOL> with open ( rq_path ) as rq : <EOL> queries . update ( { rq_file : rq . read ( ) } ) <EOL> return queries <EOL> def result_to_dataframe ( query_result ) : <EOL> csv = StringIO . StringIO ( query_result . serialize ( format = '<STR_LIT>' ) ) <EOL> return pd . read_csv ( csv ) </s>
