Search in sources :

Example 16 with LabeledResource

use of org.molgenis.data.semantic.LabeledResource in project molgenis by molgenis.

the class UntypedTagService method removeAttributeTag.

@Override
public void removeAttributeTag(EntityType entityType, SemanticTag<Attribute, LabeledResource, LabeledResource> removeTag) {
    Attribute attribute = removeTag.getSubject();
    Entity attributeEntity = findAttributeEntity(entityType, attribute.getName());
    List<Entity> tags = new ArrayList<>();
    for (Entity tagEntity : attributeEntity.getEntities(AttributeMetadata.TAGS)) {
        SemanticTag<Attribute, LabeledResource, LabeledResource> tag = SemanticTag.asTag(attribute, tagEntity);
        if (!removeTag.equals(tag)) {
            tags.add(tagEntity);
        }
    }
    attributeEntity.set(AttributeMetadata.TAGS, tags);
    dataService.update(ATTRIBUTE_META_DATA, attributeEntity);
}
Also used : Entity(org.molgenis.data.Entity) LabeledResource(org.molgenis.data.semantic.LabeledResource) ArrayList(java.util.ArrayList)

Aggregations

LabeledResource (org.molgenis.data.semantic.LabeledResource)16 Model (org.eclipse.rdf4j.model.Model)12 LinkedHashModel (org.eclipse.rdf4j.model.impl.LinkedHashModel)12 Attribute (org.molgenis.data.meta.model.Attribute)12 Relation (org.molgenis.data.semantic.Relation)12 AbstractMockitoTest (org.molgenis.test.AbstractMockitoTest)12 Test (org.testng.annotations.Test)12 Iterator (java.util.Iterator)10 Entity (org.molgenis.data.Entity)9 EntityType (org.molgenis.data.meta.model.EntityType)9 Instant (java.time.Instant)1 LocalDate (java.time.LocalDate)1 ArrayList (java.util.ArrayList)1 IRI (org.eclipse.rdf4j.model.IRI)1 Resource (org.eclipse.rdf4j.model.Resource)1 Statement (org.eclipse.rdf4j.model.Statement)1 SemanticTag (org.molgenis.data.semantic.SemanticTag)1 RunAsSystem (org.molgenis.security.core.runas.RunAsSystem)1