public static String getCitationString(Citable citable, String prepend, String postpend) { List<Citation> citations = citable.getCitations(); if (citations == null || citations.size() == 0) { return null; } StringBuilder builder = new StringBuilder(); for (Citation citation : citations) { builder.append(prepend); builder.append(citation.toString()); builder.append(postpend); } return builder.toString(); }
/** {@inheritDoc} */ @Override public Evidence[] mapEdgeToEvidence(Graph graph, Edge edge) { if (graph == null) throw new NullPointerException("graph cannot be null"); if (edge == null) throw new NullPointerException("edge cannot be null"); if (edge.metadata == null) return new Evidence[0]; Object evidences = edge.metadata.get("evidences"); if (evidences == null || !(evidences instanceof List)) return new Evidence[0]; List<Map> evidenceMap = typedList(((List) evidences), Map.class); List<Evidence> evidenceList = new ArrayList<Evidence>(); for (Map item : evidenceMap) { @SuppressWarnings("unchecked") Map<String, Object> evMap = (Map<String, Object>) item; Evidence ev = new Evidence(); ev.belStatement = getOrEmptyString("bel_statement", evMap).replace("\\\"", "\""); ev.summaryText = getOrEmptyString("summary_text", evMap); Citation citation = new Citation(); @SuppressWarnings("unchecked") Map<String, Object> citationMap = (Map<String, Object>) evMap.get("citation"); if (citationMap != null) { citation.id = getOrEmptyString("id", citationMap); citation.type = getOrEmptyString("type", citationMap); citation.name = getOrEmptyString("name", citationMap); } ev.citation = citation; BiologicalContext context = new BiologicalContext(); @SuppressWarnings("unchecked") Map<String, Object> contextMap = (Map<String, Object>) evMap.get("biological_context"); if (contextMap != null) { context.speciesCommonName = getOrEmptyString("species_common_name", contextMap); context.ncbiTaxId = getOrZero("ncbi_tax_id", contextMap); Set<String> varying = new HashSet<String>(contextMap.keySet()); varying.removeAll(asList("species_common_name", "ncbi_tax_id")); for (String key : varying) { context.variedAnnotations.put(key, contextMap.get(key)); } ev.biologicalContext = context; } evidenceList.add(ev); } return evidenceList.toArray(new Evidence[evidenceList.size()]); }
public GbifRacine parse(Element element, EmlData data) { this.setDateStamp(element.getChildText("dateStamp")); this.setHierarchyLevel(element.getChildText("hierarchyLevel")); citation = new Citation(); this.setCitation(citation.parse(element.getChild("citation"), this)); if (element.getChild("bibliography") != null) { bibliography = new ArrayList<Biblio>(); List<Element> bibliographyElement = element.getChild("bibliography").getChildren("citation"); for (int i = 0; i < bibliographyElement.size(); i++) { Biblio cit = new Biblio(); this.addBibliography(cit.parse(bibliographyElement.get(i), this)); } } physicals = new ArrayList<Physical>(); List<Element> physicalsElement = element.getChildren("physical"); for (int i = 0; i < physicalsElement.size(); i++) { Physical phys = new Physical(); this.addPhysical(phys.parse(physicalsElement.get(i), this)); } this.setResourceLogoUrl(element.getChildText("resourceLogoUrl")); collection = new GbifCollection(); this.setCollection(collection.parse(element.getChild("collection"), this)); this.setFormationPeriod(element.getChildText("formationPeriod")); this.setSpecimenPreservationMethod(element.getChildText("specimenPreservationMethod")); this.setLivingTimePeriod(element.getChildText("livingTimePeriod")); jgtiCuratorialUnits = new ArrayList<JgtiCuratorialUnit>(); List<Element> jgtiElement = element.getChildren("jgtiCuratorialUnit"); for (int i = 0; i < jgtiElement.size(); i++) { JgtiCuratorialUnit jgti = new JgtiCuratorialUnit(); this.addJgtiCuratorialUnits(jgti.parse(jgtiElement.get(i), this)); } this.setEmlData(data); return this; }