Search in sources :

Example 6 with Ontology

use of org.molgenis.ontology.core.model.Ontology in project molgenis by molgenis.

the class OntologyTagServiceTest method testGetTagEntity.

@Test
public void testGetTagEntity() {
    Tag expected = tagFactory.create();
    expected.set(TagMetadata.ID, "1233");
    expected.set(TagMetadata.OBJECT_IRI, "http://edamontology.org/data_3031");
    expected.set(TagMetadata.LABEL, "Core data");
    expected.set(TagMetadata.RELATION_IRI, "http://molgenis.org/biobankconnect/instanceOf");
    expected.set(TagMetadata.RELATION_LABEL, "instanceOf");
    expected.set(TagMetadata.CODE_SYSTEM, "http://edamontology.org");
    OntologyTerm coreData = mock(OntologyTerm.class);
    when(coreData.getIRI()).thenReturn("http://edamontology.org/data_3031");
    when(coreData.getLabel()).thenReturn("Core data");
    Ontology edamOntology = mock(Ontology.class);
    when(edamOntology.getIRI()).thenReturn("http://edamontology.org");
    SemanticTag<Object, OntologyTerm, Ontology> tag = new SemanticTag<>("1233", null, Relation.instanceOf, coreData, edamOntology);
    when(tagRepository.getTagEntity("http://edamontology.org/data_3031", "Core data", Relation.instanceOf, "http://edamontology.org")).thenReturn(expected);
    assertEquals(ontologyTagService.getTagEntity(tag), expected);
}
Also used : Ontology(org.molgenis.ontology.core.model.Ontology) SemanticTag(org.molgenis.data.semantic.SemanticTag) OntologyTag(org.molgenis.semanticsearch.semantic.OntologyTag) OntologyTerm(org.molgenis.ontology.core.model.OntologyTerm) SemanticTag(org.molgenis.data.semantic.SemanticTag) Test(org.testng.annotations.Test) AbstractMolgenisSpringTest(org.molgenis.data.AbstractMolgenisSpringTest)

Aggregations

Ontology (org.molgenis.ontology.core.model.Ontology)6 OntologyTerm (org.molgenis.ontology.core.model.OntologyTerm)5 AbstractMolgenisSpringTest (org.molgenis.data.AbstractMolgenisSpringTest)2 Relation (org.molgenis.data.semantic.Relation)2 SemanticTag (org.molgenis.data.semantic.SemanticTag)2 Test (org.testng.annotations.Test)2 Multimap (com.google.common.collect.Multimap)1 Entity (org.molgenis.data.Entity)1 UnknownEntityException (org.molgenis.data.UnknownEntityException)1 Attribute (org.molgenis.data.meta.model.Attribute)1 EntityType (org.molgenis.data.meta.model.EntityType)1 OntologyTag (org.molgenis.semanticsearch.semantic.OntologyTag)1