@Override public void addSettings(String annotationSourceFileName) { pluginSettings.set(fileLocationAttributeName, annotationSourceFileName); }
protected void createEntities(List<String> hpoTerms, Map<String, String> geneMap, Scanner rowScanner, String gene, int i, List<Entity> entities) { Entity entity = geneNetworkScoreFactory.create(); entity.set(GeneNetworkScoreMetaData.ENSEMBL_ID, gene); entity.set(GeneNetworkScoreMetaData.HPO, hpoTerms.get(i)); entity.set(GeneNetworkScoreMetaData.SCORE, Double.parseDouble(rowScanner.next())); entity.set(GeneNetworkScoreMetaData.HUGO_SYMBOL, geneMap.get(gene)); entities.add(entity); }
/** * Creates a new {@link DynamicEntity} for this MappingProject. Doesn't yet fill the {@link EntityMapping}s. */ private Entity toMappingTargetEntity(MappingTarget mappingTarget, List<Entity> entityMappingEntities) { Entity mappingTargetEntity = new DynamicEntity(mappingTargetMetaData); mappingTargetEntity.set(MappingProjectMetaData.IDENTIFIER, mappingTarget.getIdentifier()); mappingTargetEntity.set(MappingTargetMetaData.TARGET, mappingTarget.getTarget().getId()); mappingTargetEntity.set(MappingTargetMetaData.ENTITY_MAPPINGS, entityMappingEntities); return mappingTargetEntity; }
/** * Creates a new {@link DynamicEntity} for this MappingProject. Doesn't yet fill the {@link * EntityMapping}s. */ private Entity toMappingTargetEntity( MappingTarget mappingTarget, List<Entity> entityMappingEntities) { Entity mappingTargetEntity = new DynamicEntity(mappingTargetMetaData); mappingTargetEntity.set(MappingProjectMetaData.IDENTIFIER, mappingTarget.getIdentifier()); mappingTargetEntity.set(MappingTargetMetaData.TARGET, mappingTarget.getTarget().getId()); mappingTargetEntity.set(MappingTargetMetaData.ENTITY_MAPPINGS, entityMappingEntities); return mappingTargetEntity; }
private Entity toEntityMappingEntity(EntityMapping entityMapping, List<Entity> attributeMappingEntities) { Entity entityMappingEntity = new DynamicEntity(entityMappingMetaData); entityMappingEntity.set(EntityMappingMetaData.IDENTIFIER, entityMapping.getIdentifier()); entityMappingEntity.set(EntityMappingMetaData.SOURCE_ENTITY_TYPE, entityMapping.getName()); entityMappingEntity.set(EntityMappingMetaData.TARGET_ENTITY_TYPE, entityMapping.getTargetEntityType() != null ? entityMapping.getTargetEntityType().getId() : null); entityMappingEntity.set(EntityMappingMetaData.ATTRIBUTE_MAPPINGS, attributeMappingEntities); return entityMappingEntity; } }
private Entity addEntry(String term, PubMedTFEntity pubMedTFEntity, DataService dataService) { if (pubMedTFEntity == null) return null; // FIXME remove reference to getApplicationContext TermFrequencyMetaData termFrequencyEntityType = getApplicationContext().getBean(TermFrequencyMetaData.class); Entity entity = new DynamicEntity(termFrequencyEntityType); entity.set(TERM, term); entity.set(FREQUENCY, pubMedTFEntity.getFrequency()); entity.set(OCCURRENCE, pubMedTFEntity.getOccurrence()); dataService.add(TERM_FREQUENCY, entity); return entity; }
@Override public Entity next() { Entity entity = iterator.next(); if (isEmpty(entity.getString(ALLOWED_IDENTIFIER))) { DynamicEntity dynamicEntity = new DynamicEntity(getEntityType()); dynamicEntity.set(entity); entity = dynamicEntity; entity.set(ALLOWED_IDENTIFIER, String.valueOf(count.incrementAndGet())); } return entity; } };
@Override public void set(String attributeName, Object value) { Entity entity = getEntity(); entity.set(attributeName, value); updateEntity(entity); }
private void applyMappingToAttribute( AttributeMapping attributeMapping, Entity sourceEntity, Entity target, EntityType entityType, int depth) { String targetAttributeName = attributeMapping.getTargetAttribute().getName(); Object typedValue = algorithmService.apply(attributeMapping, sourceEntity, entityType, depth); target.set(targetAttributeName, typedValue); }
private void applyMappingToAttribute(AttributeMapping attributeMapping, Entity sourceEntity, Entity target, EntityType entityType) { String targetAttributeName = attributeMapping.getTargetAttribute().getName(); Object typedValue = algorithmService.apply(attributeMapping, sourceEntity, entityType); target.set(targetAttributeName, typedValue); }
@Override public void addAttributeTag( EntityType entityType, SemanticTag<Attribute, LabeledResource, LabeledResource> tag) { Entity entity = findAttributeEntity(entityType, tag.getSubject().getName()); List<Entity> tags = new ArrayList<>(); for (Entity tagEntity : entity.getEntities(AttributeMetadata.TAGS)) { tags.add(tagEntity); } tags.add(getTagEntity(tag)); entity.set(AttributeMetadata.TAGS, tags); dataService.update(ATTRIBUTE_META_DATA, entity); }
@Override public void addAttributeTag(EntityType entityType, SemanticTag<Attribute, LabeledResource, LabeledResource> tag) { Entity entity = findAttributeEntity(entityType, tag.getSubject().getName()); List<Entity> tags = new ArrayList<Entity>(); for (Entity tagEntity : entity.getEntities(AttributeMetadata.TAGS)) { tags.add(tagEntity); } tags.add(getTagEntity(tag)); entity.set(AttributeMetadata.TAGS, tags); dataService.update(ATTRIBUTE_META_DATA, entity); }
@Override public void addAttributeTag( EntityType entityType, SemanticTag<Attribute, OntologyTerm, Ontology> tag) { Entity entity = findAttributeEntity(entityType.getId(), tag.getSubject().getName()); List<Entity> tags = new ArrayList<>(); for (Entity tagEntity : entity.getEntities(AttributeMetadata.TAGS)) { tags.add(tagEntity); } tags.add(getTagEntity(tag)); entity.set(AttributeMetadata.TAGS, tags); dataService.update(ATTRIBUTE_META_DATA, entity); }
@Override public void addAttributeTag(EntityType entityType, SemanticTag<Attribute, OntologyTerm, Ontology> tag) { Entity entity = findAttributeEntity(entityType.getId(), tag.getSubject().getName()); List<Entity> tags = new ArrayList<Entity>(); for (Entity tagEntity : entity.getEntities(AttributeMetadata.TAGS)) { tags.add(tagEntity); } tags.add(getTagEntity(tag)); entity.set(AttributeMetadata.TAGS, tags); dataService.update(ATTRIBUTE_META_DATA, entity); }
private void tryUpdate(JobExecution jobExecution) { Entity jobExecutionCopy = new DynamicEntity(jobExecution.getEntityType()); jobExecutionCopy.set(jobExecution); try { dataService.update(jobExecutionCopy.getEntityType().getId(), jobExecutionCopy); } catch (Exception ex) { LOG.warn("Error updating job execution", ex); } } }
@Override public void removeAttributeTag(String entity, String attribute, String relationIRI, String ontologyTermIRI) { Entity attributeEntity = findAttributeEntity(entity, attribute); Iterable<Entity> tags = attributeEntity.getEntities(AttributeMetadata.TAGS); Iterable<Entity> newTags = Iterables.filter(tags, e -> !isSameTag(relationIRI, ontologyTermIRI, e)); attributeEntity.set(AttributeMetadata.TAGS, newTags); dataService.update(ATTRIBUTE_META_DATA, attributeEntity); updateEntityTypeEntityWithNewAttributeEntity(entity, attribute, attributeEntity); }
private Entity applyMappingToEntity(EntityMapping sourceMapping, Entity sourceEntity, EntityType targetMetaData) { Entity target = new DynamicEntity(targetMetaData); if (targetMetaData.getAttribute(SOURCE) != null) { target.set(SOURCE, sourceMapping.getName()); } sourceMapping.getAttributeMappings().forEach( attributeMapping -> applyMappingToAttribute(attributeMapping, sourceEntity, target, sourceMapping.getSourceEntityType())); return target; }
private void setRowValueForAttribute(Entity row, int index, Column column) { String attributeName = oneClickImporterNamingService.asValidColumnName(column.getName()); Object dataValue = column.getDataValues().get(index); EntityType rowType = row.getEntityType(); Attribute attribute = rowType.getAttribute(attributeName); Object castedValue = oneClickImporterService.castValueAsAttributeType(dataValue, attribute.getDataType()); row.set(attributeName, castedValue); }