@Test public void testPropertyFilterForItem() { ItemIdValue s = Datamodel.makeWikidataItemIdValue("Q42"); PropertyIdValue p1 = Datamodel.makeWikidataPropertyIdValue("P1"); PropertyIdValue p2 = Datamodel.makeWikidataPropertyIdValue("P2"); PropertyIdValue p3 = Datamodel.makeWikidataPropertyIdValue("P3"); PropertyIdValue p4 = Datamodel.makeWikidataPropertyIdValue("P4"); Set<PropertyIdValue> propertyFilter = new HashSet<>(); propertyFilter.add(p1); propertyFilter.add(p3); DocumentDataFilter documentDataFilter = new DocumentDataFilter(); documentDataFilter.setPropertyFilter(propertyFilter); DatamodelFilter filter = new DatamodelFilter(new DataObjectFactoryImpl(), documentDataFilter); ItemDocument itemDocument = Datamodel.makeItemDocument( s, Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), Arrays.asList( makeTestStatementGroup(p1, s), makeTestStatementGroup(p2, s), makeTestStatementGroup(p3, s), makeTestStatementGroup(p4, s) ), Collections.emptyMap() ); ItemDocument itemDocumentFiltered = Datamodel.makeItemDocument( s, Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), Arrays.asList( makeTestStatementGroup(p1, s), makeTestStatementGroup(p3, s) ), Collections.emptyMap() ); assertEquals(itemDocumentFiltered, filter.filter(itemDocument)); }
public ItemDocument filter(ItemDocument item) { return dataObjectFactory.getItemDocument( item.getEntityId(), filterMonoLingualTextValues(item.getLabels().values()), filterMonoLingualTextValues(item.getDescriptions().values()), filterMonoLingualTextValues(flatten(item.getAliases().values())), filterStatementGroups(item.getStatementGroups()), filterSiteLinks(item.getSiteLinks()), item.getRevisionId() ); }
DatamodelFilter { public ItemDocument filter(ItemDocument item) { return dataObjectFactory.getItemDocument( item.getEntityId(), filterMonoLingualTextValues(item.getLabels().values()), filterMonoLingualTextValues(item.getDescriptions().values()), filterMonoLingualTextValues(flatten(item.getAliases().values())), filterStatementGroups(item.getStatementGroups()), filterSiteLinks(item.getSiteLinks()), item.getRevisionId() ); } }
DatamodelFilter { public ItemDocument filter(ItemDocument item) { return dataObjectFactory.getItemDocument( item.getEntityId(), filterMonoLingualTextValues(item.getLabels().values()), filterMonoLingualTextValues(item.getDescriptions().values()), filterMonoLingualTextValues(flatten(item.getAliases().values())), filterStatementGroups(item.getStatementGroups()), filterSiteLinks(item.getSiteLinks()), item.getRevisionId() ); } DatamodelFilter(DataObjectFactory dataObjectFactory, DocumentDataFilter filter); }
DatamodelFilter { public ItemDocument filter(ItemDocument item) { return dataObjectFactory.getItemDocument( item.getEntityId(), filterMonoLingualTextValues(item.getLabels().values()), filterMonoLingualTextValues(item.getDescriptions().values()), filterMonoLingualTextValues(flatten(item.getAliases().values())), filterStatementGroups(item.getStatementGroups()), filterSiteLinks(item.getSiteLinks()), item.getRevisionId() ); } DatamodelFilter(DataObjectFactory dataObjectFactory, DocumentDataFilter filter); ItemDocument filter(ItemDocument item); PropertyDocument filter(PropertyDocument property); MediaInfoDocument filter(MediaInfoDocument mediaInfo); LexemeDocument filter(LexemeDocument lexeme); FormDocument filter(FormDocument form); SenseDocument filter(SenseDocument sense); }
DatamodelFilter { public ItemDocument filter(ItemDocument item) { return dataObjectFactory.getItemDocument( item.getEntityId(), filterMonoLingualTextValues(item.getLabels().values()), filterMonoLingualTextValues(item.getDescriptions().values()), filterMonoLingualTextValues(flatten(item.getAliases().values())), filterStatementGroups(item.getStatementGroups()), filterSiteLinks(item.getSiteLinks()), item.getRevisionId() ); } DatamodelFilter(DataObjectFactory dataObjectFactory, DocumentDataFilter filter); ItemDocument filter(ItemDocument item); PropertyDocument filter(PropertyDocument property); MediaInfoDocument filter(MediaInfoDocument mediaInfo); LexemeDocument filter(LexemeDocument lexeme); FormDocument filter(FormDocument form); SenseDocument filter(SenseDocument sense);  }