/** * Sets a site link filter. If given, all data will be preprocessed to * contain only data for the given site keys. * * @see DocumentDataFilter#setSiteLinkFilter(Set) * @param siteLinkFilter * set of siteLinks that should be retained (can be empty) */ public void setSiteLinkFilter(Set<String> siteLinkFilter) { this.filter.setSiteLinkFilter(siteLinkFilter); }
/** * @deprecated Use {@link DatamodelFilter} * * Sets the (possibly empty) set of site keys that are used to filter * {@link SiteLink} objects while copying data. Setting this to null * disables this filter (this is the default). If not equal to null, only * site links for the given sites will be copied. * * @param siteLinkFilter * set of site keys to use for filtering */ @Deprecated public void setOptionSiteLinkFilter(Set<String> siteLinkFilter) { filter.setSiteLinkFilter(siteLinkFilter); }
/** * @deprecated Use {@link DatamodelFilter} * * Sets the (possibly empty) set of site keys that are used to filter * {@link SiteLink} objects while copying data. Setting this to null * disables this filter (this is the default). If not equal to null, only * site links for the given sites will be copied. * * @param siteLinkFilter * set of site keys to use for filtering */ @Deprecated public void setOptionSiteLinkFilter(Set<String> siteLinkFilter) { filter.setSiteLinkFilter(siteLinkFilter); }
dataFetcher.getFilter().setSiteLinkFilter(Collections.emptySet());
documentDataFilter.setPropertyFilter(propertyFilter); documentDataFilter.setSiteLinkFilter(Collections.emptySet());
.println("*** Fetching data using filters to reduce data volume:"); wbdf.getFilter().setSiteLinkFilter(Collections.singleton("enwiki"));
/** * Constructor. Initializes various helper objects we use for the JSON * serialization, and opens the file that we want to write to. * * @throws IOException * if there is a problem opening the output file */ public JsonSerializationProcessor() throws IOException { // The filter is used to copy selected parts of the data. We use this // to remove some parts from the documents we serialize. DocumentDataFilter filter = new DocumentDataFilter(); // Only copy English labels, descriptions, and aliases: filter.setLanguageFilter(Collections.singleton("en")); // Only copy statements of some properties: Set<PropertyIdValue> propertyFilter = new HashSet<>(); propertyFilter.add(Datamodel.makeWikidataPropertyIdValue("P18")); // image propertyFilter.add(Datamodel.makeWikidataPropertyIdValue("P106")); // occupation propertyFilter.add(Datamodel.makeWikidataPropertyIdValue("P569")); // birthdate filter.setPropertyFilter(propertyFilter); // Do not copy any sitelinks: filter.setSiteLinkFilter(Collections.<String>emptySet()); this.datamodelFilter = new DatamodelFilter(new DataObjectFactoryImpl(), new DocumentDataFilter()); // The (compressed) file we write to. OutputStream outputStream = new GzipCompressorOutputStream( new BufferedOutputStream( ExampleHelpers .openExampleFileOuputStream(OUTPUT_FILE_NAME))); this.jsonSerializer = new JsonSerializer(outputStream); this.jsonSerializer.open(); }
.println("*** Fetching data using filters to reduce data volume:"); wbdf.getFilter().setSiteLinkFilter(Collections.singleton("enwiki"));