/** * Sets a language filter. If given, all data will be preprocessed to * contain only data for the given languages. * * @see DocumentDataFilter#setLanguageFilter(Set) * @param languageFilter * set of language codes that should be retained (can be empty) */ public void setLanguageFilter(Set<String> languageFilter) { this.filter.setLanguageFilter(languageFilter); }
/** * @deprecated Use {@link DatamodelFilter} * * Sets the (possibly empty) set of language codes that are used to filter * data while copying it. Setting this to null disables this filter (this is * the default). If not equal to null, only terms in the given language will * be copied. * <p> * The language filter is not applied to monolingual text values in * statements. Only labels, descriptions, and aliases are filtered. * * @param languageFilter * set of language codes to restrict copying to */ @Deprecated public void setOptionLanguageFilter(Set<String> languageFilter) { filter.setLanguageFilter(languageFilter); }
/** * @deprecated Use {@link DatamodelFilter} * * Sets the (possibly empty) set of language codes that are used to filter * data while copying it. Setting this to null disables this filter (this is * the default). If not equal to null, only terms in the given language will * be copied. * <p> * The language filter is not applied to monolingual text values in * statements. Only labels, descriptions, and aliases are filtered. * * @param languageFilter * set of language codes to restrict copying to */ @Deprecated public void setOptionLanguageFilter(Set<String> languageFilter) { filter.setLanguageFilter(languageFilter); }
WikibaseDataFetcher wbdf = new WikibaseDataFetcher(connection, siteIri); wbdf.getFilter().excludeAllProperties(); wbdf.getFilter().setLanguageFilter(Collections.singleton("en"));
WikibaseDataFetcher wbdf = new WikibaseDataFetcher(connection, siteIri); wbdf.getFilter().excludeAllProperties(); wbdf.getFilter().setLanguageFilter(Collections.singleton("en"));
dataFetcher.getFilter().setLanguageFilter(Collections.emptySet()); dataFetcher.getFilter().setSiteLinkFilter(Collections.emptySet());
documentDataFilter.setLanguageFilter(Collections.singleton("en"));
/** * 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(); }
wbdf.getFilter().setLanguageFilter(Collections.singleton("fr"));
wbdf.getFilter().setLanguageFilter(Collections.singleton("fr"));