def create_ktbs_base_for_history(self): """ Creates a kTBS Base for browser history data. """ root = get_ktbs(self._args.root) base = root.get_base(id="BrowserHistory/") if base is None: base = root.create_base(id="BrowserHistory/") return base
def setUp(): global ARGS, BASE if ARGS.ktbs is None: my_ktbs = make_ktbs() ARGS.ktbs = my_ktbs.uri elif ARGS.ktbs.startswith("file://"): my_ktbs = make_ktbs(repository=ARGS.ktbs[7:]) ARGS.ktbs = my_ktbs.uri else: my_ktbs = get_ktbs(ARGS.ktbs) BASE = my_ktbs.create_base(label="stress-ktbs-base") model = BASE.create_model("m") model.unit = KTBS.millisecond BASE.create_stored_trace("t/", "m", "2012-09-06T00:00:00Z", default_subject="Alice")
def setUp(): global ARGS, BASE if ARGS.ktbs is None: my_ktbs = make_ktbs() ARGS.ktbs = my_ktbs.uri elif ARGS.ktbs.startswith("file://"): ktbs_config = get_ktbs_configuration() ktbs_config.set('rdf_database', 'repository', ARGS.ktbs[7:]) my_ktbs = make_ktbs(ktbs_config) ARGS.ktbs = my_ktbs.uri else: my_ktbs = get_ktbs(ARGS.ktbs) BASE = my_ktbs.create_base(label="stress-ktbs-base") model = BASE.create_model("m") model.unit = KTBS.millisecond BASE.create_stored_trace("t/", "m", "2012-09-06T00:00:00Z", default_subject="Alice")
nb_favorites_pages = 2 for i in range(1, nb_favorites_pages): print "Fetching page: %s" % i favs = api.GetFavorites(page=i) if not favs: break for p in favs: user = p.user t_date = datetime.datetime.strptime(p.created_at, "%a %b %d %H:%M:%S +0000 %Y") #print "t_date: ", t_date.isoformat(), "\n" # Insert tweets as obsels trace.create_obsel(type=tw_obsel_type.get_uri(), begin=t_date, end=t_date, subject=p.text) print p.id, "[", p.created_at, "]\n\t", p.text \ ,"\n\tby: ", user.screen_name, "-", user.name, "-", user.id \ ,"\n\thastags: ", p.hashtags, "\n" if __name__ == "__main__": root = get_ktbs(KTBS_ROOT) trace = createkTBSForTweets(root) if trace is not None: getTwitterFavorites(trace) sys.exit(0)
print "Fetching page: %s" % i favs = api.GetFavorites(page=i) if not favs: break for p in favs: user = p.user t_date = datetime.datetime.strptime(p.created_at, "%a %b %d %H:%M:%S +0000 %Y") #print "t_date: ", t_date.isoformat(), "\n" # Insert tweets as obsels trace.create_obsel(type=tw_obsel_type.get_uri(), begin=t_date, end=t_date, subject=p.text) print p.id, "[", p.created_at, "]\n\t", p.text \ ,"\n\tby: ", user.screen_name, "-", user.name, "-", user.id \ ,"\n\thastags: ", p.hashtags, "\n" if __name__ == "__main__": root = get_ktbs(KTBS_ROOT) trace = createkTBSForTweets(root) if trace is not None: getTwitterFavorites(trace) sys.exit(0)