@Nonnull public static GenericEntity namedEntity (final @Nonnull Id id, final @Nonnull String displayName) { return new GenericEntity(new DefaultIdentifiable(id), new DefaultDisplayable(displayName, "GenericEntity")); } }
final @Nullable SimpleTaxon parent) super(new Object[]{ new DefaultIdentifiable(id) });
/******************************************************************************************************************* * * {@inheritDoc} * ******************************************************************************************************************/ @Override @Nonnull public <T> T as (final @Nonnull Class<T> clazz) { if (Exporter.class.equals(clazz)) { return clazz.cast(new ElmoExporter(repository)); } if (Identifiable.class.equals(clazz)) { final Id id = new Id(entity.getQName().getNamespaceURI() + entity.getQName().getLocalPart()); return clazz.cast(new DefaultIdentifiable(id)); } return super.as(clazz); }
@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, "SimpleObservable")); } catch (NotFoundException e) { // ok. no Displayable } return new SimpleObservable(capabilities.toArray()); } }
@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()); } }
final JSONObject rootObject = new JSONObject(string); final JSONObject jsonTaxonomy = rootObject.getJSONObject("Taxonomy"); final SimpleTaxonomy taxonomy = new SimpleTaxonomy(new DefaultIdentifiable(id), new DefaultDisplayable(jsonTaxonomy.getString("name"))); scan(taxonomy, null, jsonTaxonomy, 0);
instanceCapabilities.add(new DefaultIdentifiable(id));
final Set<ObservationItem> observationItems = new HashSet<ObservationItem>(); final List<Object> extras = new ArrayList<Object>(); extras.add(new DefaultIdentifiable(Converter.valueToId(statements.get(0).getSubject())));
final Source xenoCanto = new SimpleSource(new DefaultIdentifiable(new Id("http://www.xeno-canto.org")), new DefaultDisplayable("xeno-canto", ""), new Type(ObservationVocabulary.FOAF_ORGANIZATION), new Property<String>(ObservationVocabulary.FOAF_HOME_PAGE, "http://www.xeno-canto.org")); final Observable species = new SimpleObservable(new DefaultIdentifiable(taxonId), new DefaultDisplayable(displayName, ""));