@Override public synchronized Annotation getOrCreateAnnotation( Collection<BiologicalEntity> biologicalEntities, Property property, AnnotationProvenance annotationProvenance, Collection<URI> semanticTags) { List<String> idContents = new ArrayList<>(); for (BiologicalEntity biologicalEntity : biologicalEntities) { for (Study s : biologicalEntity.getStudies()) { idContents.add(s.getAccession()); } if (biologicalEntity.getName() != null) { idContents.add(biologicalEntity.getName()); } if (biologicalEntity.getTypes() != null) { for (URI type : biologicalEntity.getTypes()) { idContents.add(type.toString()); } } } if (property instanceof TypedProperty) { idContents.add(((TypedProperty) property).getPropertyType()); } idContents.add(property.getPropertyValue()); for (URI semanticTag : semanticTags) { idContents.add(semanticTag.toString()); } idContents.add( annotationProvenance.getAnnotator() != null ? annotationProvenance.getAnnotator() : ""); idContents.add( annotationProvenance.getGeneratedDate() != null ? annotationProvenance.getGeneratedDate().toString() : ""); idContents.add( annotationProvenance.getAnnotationDate() != null ? annotationProvenance.getAnnotationDate().toString() : ""); idContents.add( annotationProvenance.getEvidence() != null ? annotationProvenance.getEvidence().toString() : ""); idContents.add( annotationProvenance.getSource() != null ? annotationProvenance.getSource().getURI().toString() : ""); String annotationID = generateIDFromContent(idContents.toArray(new String[idContents.size()])); return getOrCreateAnnotation( annotationID, biologicalEntities, property, annotationProvenance, semanticTags); }
@Override public synchronized BiologicalEntity getOrCreateBiologicalEntity( String bioentityName, Collection<String> bioentityTypeName, Collection<URI> bioentityTypeURI, Study... studies) { List<String> ids = new ArrayList<>(); for (Study s : studies) { ids.add(s.getAccession()); } ids.add(bioentityName); String hashID = generateIDFromContent(ids.toArray(new String[ids.size()])); return getOrCreateBiologicalEntity( bioentityName, hashID, bioentityTypeName, bioentityTypeURI, studies); }