Search in sources :

Example 1 with ATTRIBUTE_META_DATA

use of org.molgenis.data.meta.model.AttributeMetadata.ATTRIBUTE_META_DATA in project molgenis by molgenis.

the class OntologyTagServiceImpl method removeAttributeTag.

@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 = StreamSupport.stream(tags.spliterator(), false).filter(e -> !isSameTag(relationIRI, ontologyTermIRI, e)).collect(Collectors.toList());
    attributeEntity.set(AttributeMetadata.TAGS, newTags);
    dataService.update(ATTRIBUTE_META_DATA, attributeEntity);
    updateEntityTypeEntityWithNewAttributeEntity(entity, attribute, attributeEntity);
}
Also used : java.util(java.util) IdGenerator(org.molgenis.data.populate.IdGenerator) SemanticTag(org.molgenis.data.semantic.SemanticTag) TagRepository(org.molgenis.semanticsearch.repository.TagRepository) Multimap(com.google.common.collect.Multimap) RunAsSystem(org.molgenis.security.core.runas.RunAsSystem) Relation(org.molgenis.data.semantic.Relation) LinkedHashMultimap.create(com.google.common.collect.LinkedHashMultimap.create) ENTITY_TYPE_META_DATA(org.molgenis.data.meta.model.EntityTypeMetadata.ENTITY_TYPE_META_DATA) Lists(com.google.common.collect.Lists) OntologyTerm(org.molgenis.ontology.core.model.OntologyTerm) Objects.requireNonNull(java.util.Objects.requireNonNull) OntologyTag(org.molgenis.semanticsearch.semantic.OntologyTag) LabeledResource(org.molgenis.data.semantic.LabeledResource) StreamSupport(java.util.stream.StreamSupport) OntologyService(org.molgenis.ontology.core.service.OntologyService) ATTRIBUTE_META_DATA(org.molgenis.data.meta.model.AttributeMetadata.ATTRIBUTE_META_DATA) Collections.emptyList(java.util.Collections.emptyList) NotNull(javax.validation.constraints.NotNull) Maps(com.google.common.collect.Maps) Collectors(java.util.stream.Collectors) UnknownAttributeException(org.molgenis.data.UnknownAttributeException) Ontology(org.molgenis.ontology.core.model.Ontology) OntologyTagService(org.molgenis.semanticsearch.service.OntologyTagService) PACKAGE(org.molgenis.data.meta.model.PackageMetadata.PACKAGE) Stream(java.util.stream.Stream) ATTRIBUTES(org.molgenis.data.meta.model.EntityTypeMetadata.ATTRIBUTES) org.molgenis.data.meta.model(org.molgenis.data.meta.model) Entry(java.util.Map.Entry) DataService(org.molgenis.data.DataService) Package(org.molgenis.data.meta.model.Package) UnknownEntityException(org.molgenis.data.UnknownEntityException) TAG(org.molgenis.data.meta.model.TagMetadata.TAG) Entity(org.molgenis.data.Entity) Transactional(org.springframework.transaction.annotation.Transactional) Entity(org.molgenis.data.Entity)

Aggregations

LinkedHashMultimap.create (com.google.common.collect.LinkedHashMultimap.create)1 Lists (com.google.common.collect.Lists)1 Maps (com.google.common.collect.Maps)1 Multimap (com.google.common.collect.Multimap)1 java.util (java.util)1 Collections.emptyList (java.util.Collections.emptyList)1 Entry (java.util.Map.Entry)1 Objects.requireNonNull (java.util.Objects.requireNonNull)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 StreamSupport (java.util.stream.StreamSupport)1 NotNull (javax.validation.constraints.NotNull)1 DataService (org.molgenis.data.DataService)1 Entity (org.molgenis.data.Entity)1 UnknownAttributeException (org.molgenis.data.UnknownAttributeException)1 UnknownEntityException (org.molgenis.data.UnknownEntityException)1 org.molgenis.data.meta.model (org.molgenis.data.meta.model)1 ATTRIBUTE_META_DATA (org.molgenis.data.meta.model.AttributeMetadata.ATTRIBUTE_META_DATA)1 ATTRIBUTES (org.molgenis.data.meta.model.EntityTypeMetadata.ATTRIBUTES)1 ENTITY_TYPE_META_DATA (org.molgenis.data.meta.model.EntityTypeMetadata.ENTITY_TYPE_META_DATA)1