
it.tidalwave.bluebill.factsheet.bbc.StillImageUnmarshaller Maven / Gradle / Ivy
/***********************************************************************************************************************
* To change this template, choose Tools | Templates
* and open the template in the editor.
**********************************************************************************************************************/
package it.tidalwave.bluebill.factsheet.bbc;
import it.tidalwave.mobile.media.StillImage;
import it.tidalwave.util.As;
import it.tidalwave.util.Id;
import java.util.List;
import javax.annotation.Nonnull;
import org.openrdf.model.Statement;
/***********************************************************************************************************************
*
* @author Fabrizio Giudici
* @version $Id: $
*
**********************************************************************************************************************/
public class StillImageUnmarshaller extends StatementUnmarshallerSupport
{
@Nonnull
public As unmarshal (final @Nonnull List statements, final @Nonnull Context context)
{
// TODO: Android seems unable to read many large images from BBC, so we resort to thumbnails
final Id imageId = findId(statements, context);
for (final Statement statement2 : context.findStatements(WoVocabulary.FOAF_THUMBNAIL, null))
{
if (statement2.getSubject().stringValue().equals(imageId.stringValue()))
{
return new StillImage(new Id(statement2.getObject().stringValue()));
}
}
return new StillImage(imageId);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy