Esempio n. 1
0
    def post_process_results(self, results, filter_):
        rows2 = []
        for row in results:
            min_time = ht.to_naive_utc(ht.min_datetime(filter_.get('time_min', '')))
            max_time = ht.to_naive_utc(ht.max_datetime(filter_.get('time_max', '')))

            dataset_min_time = ht.to_naive_utc(ht.min_datetime(row['min_time']['value']))
            dataset_max_time = ht.to_naive_utc(ht.max_datetime(row['max_time']['value']))
        
            if max(min_time, dataset_min_time) <= min(max_time, dataset_max_time):
                rows2.append(row)
        return rows2
Esempio n. 2
0
    def _extract(self, dataset_filter=''):
        rows = self._client.query_bindings_only('''
prefix void: <http://rdfs.org/ns/void#>
prefix dstats: <http://stats.lod2.eu/vocabulary/dataset#>
prefix xs: <http://www.w3.org/2001/XMLSchema#>

select ?dataset (min(?min_time) as ?min_time) (max(?max_time) as ?max_time)
where
{
    ?dataset void:propertyPartition ?dateTimePropertyPartition.
    ?dateTimePropertyPartition dstats:minValue ?min_time.
    ?dateTimePropertyPartition dstats:maxValue ?max_time.

    filter(datatype(?min_time) = xs:dateTime)
    filter(datatype(?max_time) = xs:dateTime)
    
    ''' + dataset_filter + '''
}
group by ?dataset
''')

        self.entities = {}
        for row in rows:
            min_time = ht.to_naive_utc(
                ht.min_datetime(row['min_time']['value']))
            max_time = ht.to_naive_utc(
                ht.max_datetime(row['max_time']['value']))

            self.entities[row['dataset']['value']] = {
                'min_time': min_time,
                'max_time': max_time
            }

        self._extracted = True
Esempio n. 3
0
    def _extract(self, dataset_filter = ''):
        rows = self._client.query_bindings_only('''
prefix void: <http://rdfs.org/ns/void#>
prefix dstats: <http://stats.lod2.eu/vocabulary/dataset#>
prefix xs: <http://www.w3.org/2001/XMLSchema#>

select ?dataset (min(?min_time) as ?min_time) (max(?max_time) as ?max_time)
where
{
    ?dataset void:propertyPartition ?dateTimePropertyPartition.
    ?dateTimePropertyPartition dstats:minValue ?min_time.
    ?dateTimePropertyPartition dstats:maxValue ?max_time.

    filter(datatype(?min_time) = xs:dateTime)
    filter(datatype(?max_time) = xs:dateTime)
    
    ''' + dataset_filter + '''
}
group by ?dataset
''')
                                
        self.entities = {}
        for row in rows:
            min_time = ht.to_naive_utc(ht.min_datetime(row['min_time']['value']))
            max_time = ht.to_naive_utc(ht.max_datetime(row['max_time']['value']))

            self.entities[row['dataset']['value']] = {'min_time': min_time, 'max_time': max_time}
        
        self._extracted = True
Esempio n. 4
0
    def post_process_results(self, results, filter_):
        rows2 = []
        for row in results:
            min_time = ht.to_naive_utc(
                ht.min_datetime(filter_.get('time_min', '')))
            max_time = ht.to_naive_utc(
                ht.max_datetime(filter_.get('time_max', '')))

            dataset_min_time = ht.to_naive_utc(
                ht.min_datetime(row['min_time']['value']))
            dataset_max_time = ht.to_naive_utc(
                ht.max_datetime(row['max_time']['value']))

            if max(min_time, dataset_min_time) <= min(max_time,
                                                      dataset_max_time):
                rows2.append(row)
        return rows2
    def extract_search_subscription_time(self, subscription):
        filters = subscription.definition['filters']
        if 'time_min' in filters and 'time_max' in filters:
            return {'min_time': ht.to_naive_utc(ht.min_datetime(filters['time_min'][0])),
                    'max_time': ht.to_naive_utc(ht.max_datetime(filters['time_max'][0]))}


        return None
    def extract_search_subscription_time(self, subscription):
        filters = subscription.definition['filters']
        if 'time_min' in filters and 'time_max' in filters:
            return {
                'min_time':
                ht.to_naive_utc(ht.min_datetime(filters['time_min'][0])),
                'max_time':
                ht.to_naive_utc(ht.max_datetime(filters['time_max'][0]))
            }

        return None