/** * Constructor. * * @param entityDocumentProcessor * the processor to use on the filtered data * @param filter * the filter settings to be used */ public EntityDocumentProcessorFilter( EntityDocumentProcessor entityDocumentProcessor, DocumentDataFilter filter) { this.entityDocumentProcessor = entityDocumentProcessor; this.datamodelFilter = new DatamodelFilter(new DataObjectFactoryImpl(), filter); }
/** * Constructor. * * @param entityDocumentProcessor * the processor to use on the filtered data * @param filter * the filter settings to be used */ public EntityDocumentProcessorFilter( EntityDocumentProcessor entityDocumentProcessor, DocumentDataFilter filter) { this.entityDocumentProcessor = entityDocumentProcessor; this.datamodelFilter = new DatamodelFilter(new DataObjectFactoryImpl(), filter); }
this.datamodelFilter = new DatamodelFilter(new DataObjectFactoryImpl(), documentDataFilter);
/** * 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(); }