@Test void testAddStatementsForEntityType() { Model model = new LinkedHashModel(); Resource subject = valueFactory.createIRI("http: LabeledResource object = new LabeledResource("http: LabeledResource codeSystem = new LabeledResource("ex:object"); SemanticTag<EntityType, LabeledResource, LabeledResource> tag = new SemanticTag<>("tagId", entityType, isAssociatedWith, object, codeSystem); when(objectEntity.getEntityType()).thenReturn(entityType); when(tagService.getTagsForEntity(entityType)).thenReturn(List.of(tag)); writer.addStatementsForEntity(model, subject, objectEntity); Statement statement = valueFactory.createStatement( subject, TYPE, valueFactory.createIRI("http: assertEquals(singletonList(statement), newArrayList(model)); }
void addStatementsForEntity(Model model, Resource subject, Entity entity) { for (SemanticTag<EntityType, LabeledResource, LabeledResource> tag : tagService.getTagsForEntity(entity.getEntityType())) { if (tag.getRelation() == Relation.isAssociatedWith) { LabeledResource object = tag.getObject(); model.add(subject, rdfTypePredicate, valueFactory.createIRI(object.getIri())); if (DCAT_RESOURCE.equals(object.getIri())) { model.add(subject, fdpMetadataIdentifier, createDataciteIdentifierNode(model, subject)); } if (R3D_REPOSITORY.equals(object.getIri())) { model.add(subject, r3dRepositoryIdentifier, createDataciteIdentifierNode(model, subject)); } } } }
EntityModelWriter { void addStatementsForEntity(Model model, Resource subject, Entity entity) { for (SemanticTag<EntityType, LabeledResource, LabeledResource> tag : tagService.getTagsForEntity(entity.getEntityType())) { if (tag.getRelation() == Relation.isAssociatedWith) { LabeledResource object = tag.getObject(); model.add(subject, rdfTypePredicate, valueFactory.createIRI(object.getIri())); if (DCAT_RESOURCE.equals(object.getIri())) { model.add(subject, fdpMetadataIdentifier, createDataciteIdentifierNode(model, subject)); } if (R3D_REPOSITORY.equals(object.getIri())) { model.add(subject, r3dRepositoryIdentifier, createDataciteIdentifierNode(model, subject)); } } } } }
EntityModelWriter { void addStatementsForEntity(Model model, Resource subject, Entity entity) { for (SemanticTag<EntityType, LabeledResource, LabeledResource> tag : tagService.getTagsForEntity(entity.getEntityType())) { if (tag.getRelation() == Relation.isAssociatedWith) { LabeledResource object = tag.getObject(); model.add(subject, rdfTypePredicate, valueFactory.createIRI(object.getIri())); if (DCAT_RESOURCE.equals(object.getIri())) { model.add(subject, fdpMetadataIdentifier, createDataciteIdentifierNode(model, subject)); } if (R3D_REPOSITORY.equals(object.getIri())) { model.add(subject, r3dRepositoryIdentifier, createDataciteIdentifierNode(model, subject)); } } } } EntityModelWriter(
      TagService<LabeledResource, LabeledResource> tagService, SimpleValueFactory valueFactory); }
EntityModelWriter { void addStatementsForEntity(Model model, Resource subject, Entity entity) { for (SemanticTag<EntityType, LabeledResource, LabeledResource> tag : tagService.getTagsForEntity(entity.getEntityType())) { if (tag.getRelation() == Relation.isAssociatedWith) { LabeledResource object = tag.getObject(); model.add(subject, rdfTypePredicate, valueFactory.createIRI(object.getIri())); if (DCAT_RESOURCE.equals(object.getIri())) { model.add(subject, fdpMetadataIdentifier, createDataciteIdentifierNode(model, subject)); } if (R3D_REPOSITORY.equals(object.getIri())) { model.add(subject, r3dRepositoryIdentifier, createDataciteIdentifierNode(model, subject)); } } } } 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 { void addStatementsForEntity(Model model, Resource subject, Entity entity) { for (SemanticTag<EntityType, LabeledResource, LabeledResource> tag : tagService.getTagsForEntity(entity.getEntityType())) { if (tag.getRelation() == Relation.isAssociatedWith) { LabeledResource object = tag.getObject(); model.add(subject, rdfTypePredicate, valueFactory.createIRI(object.getIri())); if (DCAT_RESOURCE.equals(object.getIri())) { model.add(subject, fdpMetadataIdentifier, createDataciteIdentifierNode(model, subject)); } if (R3D_REPOSITORY.equals(object.getIri())) { model.add(subject, r3dRepositoryIdentifier, createDataciteIdentifierNode(model, subject)); } } } } 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; }