@Override @Nonnull public As unmarshal (final @Nonnull List<Statement> statements, final @Nonnull Context context) { // TODO: what about retrieving the observationSet and calling findOrCreate(?) final List<Object> capabilities = new ArrayList<Object>(); capabilities.add(new DefaultIdentifiable(Converter.valueToId(statements.get(0).getSubject()))); try { final String displayName = findStatementWithPredicate(statements, ObservationVocabulary.RDFS_LABEL).getObject().stringValue(); capabilities.add(new DefaultDisplayable(displayName, "SimpleSource")); } catch (NotFoundException e) { // ok. no Displayable } addCapabilities(capabilities, statements, ObservationVocabulary.FOAF_HOME_PAGE); return new SimpleSource(capabilities.toArray()); } }
/******************************************************************************************************************* * * ******************************************************************************************************************/ public StatementUnmarshallerFactoryImpl() { // FIXME: discover with Lookup unmarshallerMapByType.put(ObservationVocabulary.OBS_OBSERVATION_SET, new SimpleObservationSetUnmarshaller()); unmarshallerMapByType.put(ObservationVocabulary.OBS_OBSERVATION, new SimpleObservationUnmarshaller()); unmarshallerMapByType.put(ObservationVocabulary.OBS_OBSERVATION_ITEM, new SimpleObservationItemUnmarshaller()); unmarshallerMapByType.put(ObservationVocabulary.OBS_OBSERVABLE, new SimpleObservableUnmarshaller()); unmarshallerMapByType.put(ObservationVocabulary.OBS_OBSERVER, new SimpleObserverUnmarshaller()); unmarshallerMapByType.put(ObservationVocabulary.DC_PUBLISHER, new SimpleSourceUnmarshaller()); unmarshallerMapByType.put(ObservationVocabulary.OBS_LOCATION, new SimpleLocationUnmarshaller()); // factoryMapByType.put(Media.FOAF_DOCUMENT, new MediaTripleUnmarshaller()); }