@Test void testCreateRfdModelForEntity() { List<Attribute> attributeList = singletonList(attribute); when(objectEntity.getEntityType()).thenReturn(entityType); when(entityType.getId()).thenReturn("fdp_Catalog"); when(objectEntity.getIdValue()).thenReturn("catalogId"); when(objectEntity.get("attributeName1")).thenReturn("value1"); when(objectEntity.getString("attributeName1")).thenReturn("value1"); when(entityType.getAtomicAttributes()).thenReturn(attributeList); when(attribute.getName()).thenReturn("attributeName1"); when(attribute.getDataType()).thenReturn(STRING); when(tagService.getTagsForEntity(entityType)).thenReturn(List.of(entityTag, entityTag2)); when(entityTag.getRelation()).thenReturn(isAssociatedWith); when(entityTag.getObject()).thenReturn(labeledResource); when(labeledResource.getIri()).thenReturn(DCAT_RESOURCE); when(entityTag2.getRelation()).thenReturn(isAssociatedWith); when(entityTag2.getObject()).thenReturn(labeledResource2); when(labeledResource2.getIri()).thenReturn(R3D_REPOSITORY); LabeledResource tag1 = new LabeledResource("http: Multimap<Relation, LabeledResource> tags = ImmutableMultimap.of(isAssociatedWith, tag1); when(tagService.getTagsForAttribute(entityType, attribute)).thenReturn(tags); Model result = writer.createRdfModel(objectEntity); assertEquals(9, result.size()); StringWriter writer = new StringWriter(); Rio.write(result, writer, TURTLE, new WriterConfig().set(INLINE_BLANK_NODES, true)); assertThat(writer.toString()) .contains("<http: .contains( "fdp:metadataIdentifier [ a datacite:Identifier;\n" + " dct:identifier <http: + " ]") .contains( "r3d:repositoryIdentifier [ a datacite:Identifier;\n" + " dct:identifier <http: + " ]"); }
public Model createRdfModel(Entity objectEntity) { Model model = createEmptyModel(); Resource subject = createResource(objectEntity); addEntityToModel(subject, objectEntity, model); return model; }
EntityModelWriter { public Model createRdfModel(Entity objectEntity) { Model model = createEmptyModel(); Resource subject = createResource(objectEntity); addEntityToModel(subject, objectEntity, model); return model; } }
EntityModelWriter { public Model createRdfModel(Entity objectEntity) { Model model = createEmptyModel(); Resource subject = createResource(objectEntity); addEntityToModel(subject, objectEntity, model); return model; } EntityModelWriter(
      TagService<LabeledResource, LabeledResource> tagService, SimpleValueFactory valueFactory); }
EntityModelWriter { public Model createRdfModel(Entity objectEntity) { Model model = createEmptyModel(); Resource subject = createResource(objectEntity); addEntityToModel(subject, objectEntity, model); return model; } EntityModelWriter(
      TagService<LabeledResource, LabeledResource> tagService, SimpleValueFactory valueFactory); Model createRdfModel(Entity objectEntity); Model createEmptyModel(); void addEntityToModel(Resource subject, Entity objectEntity, Model model); boolean isADcatResource(EntityType entityType); }
EntityModelWriter { public Model createRdfModel(Entity objectEntity) { Model model = createEmptyModel(); Resource subject = createResource(objectEntity); addEntityToModel(subject, objectEntity, model); return model; } EntityModelWriter(
      TagService<LabeledResource, LabeledResource> tagService, SimpleValueFactory valueFactory); Model createRdfModel(Entity objectEntity); Model createEmptyModel(); void addEntityToModel(Resource subject, Entity objectEntity, Model model); boolean isADcatResource(EntityType entityType); static final String NS_DCAT; static final String NS_FDP; static final String NS_R3D; static final String NS_DATACITE; static final String NS_DCT; static final String NS_RDF; }