<s> """<STR_LIT:U+0020>""" <EOL> import sys , os , time , datetime , imp , sys , StringIO <EOL> sys . path . insert ( <NUM_LIT:0> , "<STR_LIT>" ) <EOL> from testSPARQL import ns_rdf <EOL> from testSPARQL import ns_rdfs <EOL> from testSPARQL import ns_foaf <EOL> from testSPARQL import ns_vcard <EOL> from testSPARQL import ns_person <EOL> from rdfextras . sparql import sparqlGraph <EOL> from rdflib . FileInputSource import FileInputSource <EOL> tests = { <EOL> <NUM_LIT> : "<STR_LIT>" , <EOL> <NUM_LIT> : "<STR_LIT>" , <EOL> <NUM_LIT> : "<STR_LIT>" , <EOL> } <EOL> Debug = False <EOL> def run ( modName ) : <EOL> defs = None <EOL> ( fl , realpath , descr ) = imp . find_module ( modName , [ "<STR_LIT:.>" ] ) <EOL> mod = imp . load_module ( modName , fl , realpath , descr ) <EOL> defs = mod . __dict__ <EOL> graph = None <EOL> try : <EOL> graph = defs [ "<STR_LIT>" ] <EOL> except : <EOL> pass <EOL> rdfData = None <EOL> try : <EOL> rdfData = defs [ "<STR_LIT>" ] <EOL> except : <EOL> pass <EOL> if graph == None : <EOL> stream = FileInputSource ( StringIO . StringIO ( rdfData ) ) <EOL> graph = sparqlGraph . SPARQLGraph ( ) <EOL> graph . parse ( stream , format = "<STR_LIT>" ) <EOL> pattern = defs [ "<STR_LIT>" ] <EOL> optPattern = defs [ "<STR_LIT>" ] <EOL> construct = defs [ "<STR_LIT>" ] <EOL> print "<STR_LIT>" % modName <EOL> results = graph . queryObject ( pattern , optPattern ) <EOL> graph = results . construct ( construct ) <EOL> graph . serialize ( "<STR_LIT>" ) <EOL> print "<STR_LIT>" <EOL> for l in file ( "<STR_LIT>" ) : <EOL> sys . stdout . write ( l ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> if len ( sys . argv ) == <NUM_LIT:1> : <EOL> for mod in tests . values ( ) : <EOL> run ( mod ) <EOL> else : <EOL> for mod in sys . argv [ <NUM_LIT:1> : ] : <EOL> if mod . endswith ( "<STR_LIT>" ) : <EOL> run ( mod [ <NUM_LIT:0> : - <NUM_LIT:3> ] ) <EOL> else : <EOL> run ( mod ) </s>
