(IntInterval(1, 3),), (IntInterval(2, 5),), ]) # schema definition of the data stream data_schema = Schema() data_schema.append(Attribute('name', str)) data_schema.append(Attribute('age', int)) data_schema.append(Attribute('rowid', int, True)) data_source = DBTable('test.db', 'person', data_schema) # create a data accessor data_accessor = DataAccessor( query_streamer.output(), data_source, FindRange ) query_grouper = Group( query_streamer.output(), {'age': lambda a, b: a is b} ) qselect = Select( query_grouper.output(), AttributeRename( query_grouper.output().schema(), { 'age': 'age_range' } ) )
engines = [] counters = [] # The query stream contains only a single query box. query_streamer = ArrayStreamer(query_schema, [ (query, ), ]) engines.append(query_streamer) counties_source = Rtree(counties_file, 'counties.the_geom') counties_accessor = DataAccessor( query_streamer.output(), counties_source, FindRange, ) engines.append(counties_accessor) demux = Demux(counties_accessor.output()) def intersection(a, b): g1 = a.geom() g2 = b.geom() try: if g1.is_valid and g2.is_valid: i = g1.intersection(g2) return Geometry(i) else:
for i, c in enumerate(self._c): self._c[i] = self._af[i][1](c, r[i]) engines = [] # The query stream contains only a single query. query_streamer = ArrayStreamer(query_schema, [ (IntInterval(0, int(1E10)), ), ]) engines.append(query_streamer) # Create a family data source: a table in the input database. family_source = DBTable(input_file, 'family', family_schema) # Data accessor for the species data source. family_accessor = DataAccessor(query_streamer.output(), family_source, FindRange) engines.append(family_accessor) # A group mini-engine to split the family IDs into groups. family_id_grouper = Group(family_accessor.output(), { 'family.id': lambda a, b: a == b }) engines.append(family_id_grouper) # Select only the family ID for querying genera. family_id_select = Select( family_accessor.output(), UniversalSelect( family_accessor.output().schema(), { 'genus.family_id': { 'type': int,
except: return None engines = [] counters = [] # The query stream contains only a single query box. query_streamer = ArrayStreamer(query_schema, [ (query, ), ]) engines.append(query_streamer) # Query the states from the data source. states_source = Rtree(states_file, 'states.the_geom') states_accessor = DataAccessor(query_streamer.output(), states_source, FindRange) engines.append(states_accessor) # Trim the states to the query region. states_select = Select( states_accessor.output(), UniversalSelect( states_accessor.output().schema(), { # trim geometry 'states.the_geom': { 'type': Geometry, 'args': ['states.the_geom'], 'function': lambda v: intersection(v, query), }, # keep OID
""" self._calls += 1 for i, c in enumerate(self._c): self._c[i] = self._af[i][1](c, r[i]) engines = [] counters = [] # The query stream contains only a single query box. query_streamer = ArrayStreamer(query_schema, [(query,)]) engines.append(query_streamer) counties_source = Rtree(counties_file, "counties.the_geom") counties_accessor = DataAccessor(query_streamer.output(), counties_source, FindRange) engines.append(counties_accessor) demux = Demux(counties_accessor.output()) def intersection(a, b): g1 = a.geom() g2 = b.geom() try: if g1.is_valid and g2.is_valid: i = g1.intersection(g2) return Geometry(i) else: return None except:
(IntInterval(1, 3),), (IntInterval(2, 5),), ]) # schema definition of the data stream data_schema = Schema() data_schema.append(Attribute('name', str)) data_schema.append(Attribute('age', int)) data_schema.append(Attribute('rowid', int, True)) data_source = DBTable('test.db', 'person', data_schema) # create a data accessor data_accessor = DataAccessor( query_streamer.output(), data_source, FindRange ) name_age_combiner = NameAgeCombiner(data_accessor.output().schema()) select = Select(data_accessor.output(), name_age_combiner) query_grouper = Group( query_streamer.output(), {'age': lambda a, b: a is b} ) joiner = Join(query_grouper.output(), select.output()) filter = Filter(joiner.output(), FilterNameAge(joiner.output().schema())) result_stack = ResultStack( filter.output(),
query_streamer.output().schema(), { 'states.geom': { 'type': Geometry, 'args': ['queries.geom'], 'function': lambda v: v, }, } ) ) engines.append(states_query) states_source = Rtree(states_file, 'states.geom') states_accessor = DataAccessor( states_query.output(), states_source, FindRange ) engines.append(states_accessor) states_select = Select( states_accessor.output(), UniversalSelect( states_accessor.output().schema(), { 'states.oid': { 'type': int, 'args': ['oid'], 'function': lambda v: v, }, 'states.geom': {
(IntInterval(2, 5), ), (IntInterval(2, 5), ), (IntInterval(1, 3), ), (IntInterval(2, 5), ), ]) # schema definition of the data stream data_schema = Schema() data_schema.append(Attribute('name', str)) data_schema.append(Attribute('age', int)) data_schema.append(Attribute('rowid', int, True)) data_source = DBTable('test.db', 'person', data_schema) # create a data accessor data_accessor = DataAccessor(query_streamer.output(), data_source, FindRange) name_age_combiner = NameAgeCombiner(data_accessor.output().schema()) select = Select(data_accessor.output(), name_age_combiner) query_grouper = Group(query_streamer.output(), {'age': lambda a, b: a is b}) joiner = Join(query_grouper.output(), select.output()) filter = Filter(joiner.output(), FilterNameAge(joiner.output().schema())) result_stack = ResultStack( filter.output(), # joiner.output(), # query_streamer.output(), # query_grouper.output(), # select.output(), )
# schema definition of the data stream data_schema = Schema() data_schema.append(Attribute('name', str)) data_schema.append(Attribute('age', int)) data_schema.append(Attribute('rowid', int, True)) data_source = DBTable('test.db', 'person', data_schema) # definition of the data source #data_source = CSVFile('test.csv', data_schema) data_accessors = [] selects = [] for i in range(0, 1): # create a data accessor data_accessor = DataAccessor(demux, data_source, FindRange) name_age_combiner = NameAgeCombiner(data_accessor.output().schema()) selects.append(Select(data_accessor.output(), name_age_combiner)) data_accessors.append(data_accessor) mux = Mux(*[s.output() for s in selects]) #name_age_combiner_reverse = NameAgeCombinerReverse(demux.schema()) #select2 = Select(demux, name_age_combiner_reverse) #name_age_combiner = NameAgeCombiner(data_accessor.output().schema()) #select = Select(data_accessor.output(), name_age_combiner) #name_age_combiner_reverse = NameAgeCombinerReverse(data_accessor.output().schema()) #select2 = Select(data_accessor.output(), name_age_combiner_reverse) result_stack = ResultStack(
self._c[i] = self._af[i][1](c, r[i]) engines = [] # The query stream contains only a single query. query_streamer = ArrayStreamer(query_schema, [ (IntInterval(0, int(1E10)),), ]) engines.append(query_streamer) # Create a family data source: a table in the input database. family_source = DBTable(input_file, 'family', family_schema) # Data accessor for the species data source. family_accessor = DataAccessor( query_streamer.output(), family_source, FindRange ) engines.append(family_accessor) # A group mini-engine to split the family IDs into groups. family_id_grouper = Group( family_accessor.output(), {'family.id': lambda a, b: a == b} ) engines.append(family_id_grouper) # Select only the family ID for querying genera. family_id_select = Select( family_accessor.output(), UniversalSelect(
Adds the specified record to the aggregate value. ''' self._calls += 1 for i, c in enumerate(self._c): self._c[i] = self._af[i][1](c, r[i]) # The query stream contains only a single query. query_streamer = ArrayStreamer(query_schema, [ (IntInterval(0, int(1E10)), ), ]) # Create a species data source: a table in the input database. species_source = DBTable(input_file, 'species', species_schema) # Data accessor for the species data source. species_accessor = DataAccessor(query_streamer.output(), species_source, FindRange) demux = Demux(species_accessor.output()) engines = [] mux_streams = [] for i in range(tracks): channel = demux.channel() # Select only the species ID for querying plants. species_id_select = Select( channel, UniversalSelect( species_accessor.output().schema(), { 'plants.species_id': { 'type': int,
return None engines = [] counters = [] # The query stream contains only a single query box. query_streamer = ArrayStreamer(query_schema, [ (query,), ]) engines.append(query_streamer) # Query the states from the data source. states_source = Rtree(states_file, 'states.the_geom') states_accessor = DataAccessor( query_streamer.output(), states_source, FindRange ) engines.append(states_accessor) # Trim the states to the query region. states_select = Select( states_accessor.output(), UniversalSelect( states_accessor.output().schema(), { # trim geometry 'states.the_geom': { 'type': Geometry, 'args': ['states.the_geom'], 'function': lambda v: intersection(v, query),
data_schema.append(Attribute('name', str)) data_schema.append(Attribute('age', int)) data_schema.append(Attribute('rowid', int, True)) data_source = DBTable('test.db', 'person', data_schema) # definition of the data source #data_source = CSVFile('test.csv', data_schema) data_accessors = [] selects = [] for i in range(0, 1): # create a data accessor data_accessor = DataAccessor( demux, data_source, FindRange ) name_age_combiner = NameAgeCombiner(data_accessor.output().schema()) selects.append(Select(data_accessor.output(), name_age_combiner)) data_accessors.append(data_accessor) mux = Mux(*[s.output() for s in selects]) #name_age_combiner_reverse = NameAgeCombinerReverse(demux.schema()) #select2 = Select(demux, name_age_combiner_reverse) #name_age_combiner = NameAgeCombiner(data_accessor.output().schema()) #select = Select(data_accessor.output(), name_age_combiner) #name_age_combiner_reverse = NameAgeCombinerReverse(data_accessor.output().schema()) #select2 = Select(data_accessor.output(), name_age_combiner_reverse)
############################################################# states_query = Select( query_streamer.output(), UniversalSelect( query_streamer.output().schema(), { 'states.geom': { 'type': Geometry, 'args': ['queries.geom'], 'function': lambda v: v, }, })) engines.append(states_query) states_source = Rtree(states_file, 'states.geom') states_accessor = DataAccessor(states_query.output(), states_source, FindRange) engines.append(states_accessor) states_select = Select( states_accessor.output(), UniversalSelect( states_accessor.output().schema(), { 'states.oid': { 'type': int, 'args': ['oid'], 'function': lambda v: v, }, 'states.geom': { 'type': Geometry, 'args': ['states.geom'], 'function': lambda v: v,
''' self._calls += 1 for i, c in enumerate(self._c): self._c[i] = self._af[i][1](c, r[i]) # The query stream contains only a single query. query_streamer = ArrayStreamer(query_schema, [ (IntInterval(0, int(1E10)),), ]) # Create a species data source: a table in the input database. species_source = DBTable(input_file, 'species', species_schema) # Data accessor for the species data source. species_accessor = DataAccessor( query_streamer.output(), species_source, FindRange ) demux = Demux(species_accessor.output()) engines = [] mux_streams = [] for i in range(tracks): channel = demux.channel() # Select only the species ID for querying plants. species_id_select = Select( channel, UniversalSelect( species_accessor.output().schema(),