@Override public ListPaginator<T> createPaginator(C concept) { MapPaginator<K, V> base = delegate.createPaginator(concept); ListPaginator<T> result = ListPaginatorMapWrapper.create(base, fn); return result; }
@Override protected Iterator<Entry<Resource, Model>> doPageRead() { long limit = (long)this.pageSize; long offset = this.page * this.pageSize; Map<Resource, Model> map = listService.fetchData(concept, limit, offset); Iterator<Entry<Resource, Model>> result = map.entrySet().iterator(); return result; } }
public static void main(String[] args) { QueryExecutionFactory qef = new QueryExecutionFactoryHttp("http://dbpedia.org/sparql"); MapService<Concept, Node, Node> ls = new ListServiceConcept(qef); Concept concept = ConceptUtils.listAllPredicates; Range<Long> countInfo; countInfo = ls.fetchCount(concept, 2l, null).blockingGet(); System.out.println(countInfo); countInfo = ls.fetchCount(concept, 3l, null).blockingGet(); System.out.println(countInfo); countInfo = ls.fetchCount(concept, 4l, null).blockingGet(); System.out.println(countInfo); countInfo = ls.fetchCount(concept, null, null).blockingGet(); System.out.println(countInfo); Map<Node, Node> data = ls.fetchData(concept, null, null); System.out.println(data); } }
@Override public MapPaginator<K, O> createPaginator(C concept) { MapPaginator<K, I> base = listService.createPaginator(concept); MapPaginator<K, O> result = MapPaginatorTransformItem.create(base, fnTransformItem); return result; }
@Override protected Iterator<Entry<Node, DatasetGraph>> doPageRead() { long limit = (long)this.pageSize; long offset = this.page * this.pageSize; Map<Node, DatasetGraph> map = listService.fetchData(concept, limit, offset); Iterator<Entry<Node, DatasetGraph>> result = map.entrySet().iterator(); return result; } }
default Map<K, V> fetchData(C concept, Range<Long> range) { Map<K, V> result = createPaginator(concept).fetchMap(range); return result; }
/** * The recommended map type to be used as the return value is LinkedHashMap. * * @param concept * @param limit * @param offset * @return */ default Map<K, V> fetchData(C concept, Long limit, Long offset) { Range<Long> range = QueryUtils.createRange(limit, offset); Map<K, V> result = fetchData(concept, range); return result; }
/** * Select Distinct ?v { * { Select ?v { * concept * } Limit rawLimit } * } Limit resLimit * * @param concept * @param itemLimit Limit applied on the set of distinct items (resources) * //@param rowLimit Limits the number of rows to scan before applying distinct * @return */ default Single<Range<Long>> fetchCount(C concept, Long itemLimit, Long rowLimit) { Single<Range<Long>> result = createPaginator(concept).fetchCount(itemLimit, rowLimit); return result; }
@Override public Iterator<Node> listGraphNodes() { QueryExecutionFactory qef = sparqlService.getQueryExecutionFactory(); MapService<Concept, Node, Node> ls = new ListServiceConcept(qef); Set<Node> nodes = ls.fetchData(ConceptUtils.listAllGraphs, null, null).keySet(); return nodes.iterator(); }
@Override public Flowable<Entry<Node, G>> apply(Range<Long> range) { Flowable<Entry<Node, G>> result = MapServiceUtils.createListServiceMappedConcept(qef, mappedConcept, isLeftJoin).createPaginator(null).apply(range); return result; // return fetchMap(range).entrySet().stream(); } }
Map<Node, DatasetGraph> nodeToDatasetGraph = ls.fetchData(concept, null, null);
Flowable<Entry<Node, V>> result = listService.createPaginator(concept).apply(null); return result;