prefix tb: <http://www.garshol.priv.no/2014/trad-beer/> prefix dbp: <http://dbpedia.org/resource/> prefix uff: <http://www.garshol.priv.no/2015/uff/> SELECT DISTINCT ?s ?lat ?lng ?t ?type WHERE { ?s dc:title ?title; geo:lat ?lat; geo:long ?lng; tb:pitch-temperature ?t; tb:yeast-type ?type. }''' groups = {} for (s, lat, lng, t, group) in sparqllib.query_for_rows(query): temp = pitch.get_temp(t) if temp: if group not in groups: groups[group] = [] groups[group].append(temp) import numpy from matplotlib import pyplot ix = 0 for groupname in GROUPS.keys(): temperatures = [] for grpid in GROUPS[groupname]: temperatures += groups.get(grpid, [])
geo:lat ?lat; geo:long ?lng; tb:pitch-temperature ?t. OPTIONAL { ?s tb:own-yeast ?yeast } }''' accounts = set() own = 0 unknown = 0 other = 0 for (s, lat, lng, t, yeast) in sparqllib.query_for_rows(query): if not pitch.get_temp(t): continue if s in accounts: print 'DUPLICATE', s accounts.add(s) if yeast == 'true': own += 1 elif yeast == 'false': other += 1 else: unknown += 1 total = own + unknown + other print 'Own yeast', own, own / float(total)