/******************************************************************************************************************* * * ******************************************************************************************************************/ 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()); }
@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(statements.get(0).getSubject())); try { final String displayName = findStatementWithPredicate(statements, ObservationVocabulary.RDFS_LABEL).getObject().stringValue(); return new SimpleLocation(new DefaultDisplayable(displayName, "SimpleLocation")); } catch (NotFoundException e) { throw new RuntimeException(e); // ok. no Displayable } // return new SimpleLocation(capabilities.toArray()); } }