diff --git a/common/testing/src/testFixtures/kotlin/org/orkg/common/testing/fixtures/Assets.kt b/common/testing/src/testFixtures/kotlin/org/orkg/common/testing/fixtures/Assets.kt new file mode 100644 index 000000000..3ef657fbf --- /dev/null +++ b/common/testing/src/testFixtures/kotlin/org/orkg/common/testing/fixtures/Assets.kt @@ -0,0 +1,13 @@ +package org.orkg.common.testing.fixtures + +import java.net.URI +import org.springframework.core.io.ClassPathResource + +object Assets { + fun requestJson(name: String): String = fileContents("requests/$name.json").decodeToString() + + fun responseJson(name: String): String = fileContents("responses/$name.json").decodeToString() + + private fun fileContents(name: String): ByteArray = + ClassPathResource(URI.create("classpath:/assets/$name").path).inputStream.use { it.readBytes() } +} diff --git a/content-types/content-types-adapter-output-simcomp/src/test/kotlin/org/orkg/contenttypes/adapter/output/simcomp/SimCompThingRepositoryAdapterUnitTest.kt b/content-types/content-types-adapter-output-simcomp/src/test/kotlin/org/orkg/contenttypes/adapter/output/simcomp/SimCompThingRepositoryAdapterUnitTest.kt index fc9a3056d..64022d24b 100644 --- a/content-types/content-types-adapter-output-simcomp/src/test/kotlin/org/orkg/contenttypes/adapter/output/simcomp/SimCompThingRepositoryAdapterUnitTest.kt +++ b/content-types/content-types-adapter-output-simcomp/src/test/kotlin/org/orkg/contenttypes/adapter/output/simcomp/SimCompThingRepositoryAdapterUnitTest.kt @@ -24,6 +24,7 @@ import org.orkg.common.OrganizationId import org.orkg.common.ThingId import org.orkg.common.exceptions.ServiceUnavailable import org.orkg.common.json.CommonJacksonModule +import org.orkg.common.testing.fixtures.Assets import org.orkg.common.testing.fixtures.MockkBaseTest import org.orkg.common.testing.fixtures.TestBodyPublisher import org.orkg.contenttypes.adapter.output.simcomp.internal.SimCompThingRepositoryAdapter @@ -63,7 +64,7 @@ internal class SimCompThingRepositoryAdapterUnitTest : MockkBaseTest { every { httpClient.send(any(), any>()) } returns response every { response.statusCode() } returns 200 - every { response.body() } returns simCompThingResponseJson + every { response.body() } returns Assets.responseJson("simcomp/thingResponse") val result = adapter.findById(id, ThingType.LIST) result.isPresent shouldBe true @@ -385,95 +386,3 @@ internal class SimCompThingRepositoryAdapterUnitTest : MockkBaseTest { verify(exactly = 1) { httpClient.send(any(), any>()) } } } - -private const val simCompThingResponseJson = """{ - "timestamp": "2024-01-26T09:26:34.297967", - "uuid": "b8e897af-e9c9-46e0-884b-90e2407b2341", - "payload": { - "thing": { - "id": "116eddfd-d6f3-4a31-a96b-24574b3d62cc", - "created_at": "2022-02-22T06:02:14.292384Z", - "updated_at": "2022-02-22T06:02:14.292395Z", - "thing_type": "LIST", - "thing_key": "R166718", - "config": {}, - "data": { - "rootResource": "R465", - "statements": [ - { - "id": "S663825", - "subject": { - "id": "R166714", - "label": "Entry", - "created_at": "2022-02-22T08:01:13.261082+01:00", - "classes": [], - "shared": 1, - "created_by": "d5416c16-1a45-4aee-8069-be1b6097478b", - "_class": "resource", - "observatory_id": "00000000-0000-0000-0000-000000000000", - "extraction_method": "UNKNOWN", - "organization_id": "00000000-0000-0000-0000-000000000000", - "featured": false, - "unlisted": false - }, - "predicate": { - "id": "HasPaper", - "label": "has paper", - "created_at": "2021-04-26T16:57:34.745465+02:00", - "created_by": "00000000-0000-0000-0000-000000000000", - "_class": "predicate", - "description": null - }, - "object": { - "id": "C12457", - "label": "Some class", - "uri": "https://orkg.org/class/C12457", - "description": "class description", - "created_at": "2022-02-22T08:01:13.261082+01:00", - "created_by": "d5416c16-1a45-4aee-8069-be1b6097478b", - "_class": "class" - }, - "created_at": "2022-02-22T08:01:15.253502+01:00", - "created_by": "d5416c16-1a45-4aee-8069-be1b6097478b" - }, - { - "id": "S5436", - "subject": { - "id": "R56984", - "label": "Other resource", - "created_at": "2022-02-22T08:01:12.709843+01:00", - "classes": [ - "Entry" - ], - "shared": 1, - "created_by": "d5416c16-1a45-4aee-8069-be1b6097478b", - "_class": "resource", - "observatory_id": "00000000-0000-0000-0000-000000000000", - "extraction_method": "MANUAL", - "organization_id": "00000000-0000-0000-0000-000000000000", - "visibility": "FEATURED" - }, - "predicate": { - "id": "HasPaper", - "label": "has paper", - "created_at": "2021-04-26T16:57:34.745465+02:00", - "created_by": "00000000-0000-0000-0000-000000000000", - "_class": "predicate", - "description": null - }, - "object": { - "id": "L354354", - "label": "Some literal", - "created_at": "2022-02-22T08:01:12.709843+01:00", - "created_by": "d5416c16-1a45-4aee-8069-be1b6097478b", - "_class": "literal", - "datatype": "xsd:string" - }, - "created_at": "2023-02-22T08:01:15.253502+01:00", - "created_by": "d5416c16-1a45-4aee-8069-be1b6097478b" - } - ] - } - } - } -}""" diff --git a/content-types/content-types-adapter-output-simcomp/src/test/resources/assets/responses/simcomp/thingResponse.json b/content-types/content-types-adapter-output-simcomp/src/test/resources/assets/responses/simcomp/thingResponse.json new file mode 100644 index 000000000..dff5cf2a8 --- /dev/null +++ b/content-types/content-types-adapter-output-simcomp/src/test/resources/assets/responses/simcomp/thingResponse.json @@ -0,0 +1,91 @@ +{ + "timestamp": "2024-01-26T09:26:34.297967", + "uuid": "b8e897af-e9c9-46e0-884b-90e2407b2341", + "payload": { + "thing": { + "id": "116eddfd-d6f3-4a31-a96b-24574b3d62cc", + "created_at": "2022-02-22T06:02:14.292384Z", + "updated_at": "2022-02-22T06:02:14.292395Z", + "thing_type": "LIST", + "thing_key": "R166718", + "config": {}, + "data": { + "rootResource": "R465", + "statements": [ + { + "id": "S663825", + "subject": { + "id": "R166714", + "label": "Entry", + "created_at": "2022-02-22T08:01:13.261082+01:00", + "classes": [], + "shared": 1, + "created_by": "d5416c16-1a45-4aee-8069-be1b6097478b", + "_class": "resource", + "observatory_id": "00000000-0000-0000-0000-000000000000", + "extraction_method": "UNKNOWN", + "organization_id": "00000000-0000-0000-0000-000000000000", + "featured": false, + "unlisted": false + }, + "predicate": { + "id": "HasPaper", + "label": "has paper", + "created_at": "2021-04-26T16:57:34.745465+02:00", + "created_by": "00000000-0000-0000-0000-000000000000", + "_class": "predicate", + "description": null + }, + "object": { + "id": "C12457", + "label": "Some class", + "uri": "https://orkg.org/class/C12457", + "description": "class description", + "created_at": "2022-02-22T08:01:13.261082+01:00", + "created_by": "d5416c16-1a45-4aee-8069-be1b6097478b", + "_class": "class" + }, + "created_at": "2022-02-22T08:01:15.253502+01:00", + "created_by": "d5416c16-1a45-4aee-8069-be1b6097478b" + }, + { + "id": "S5436", + "subject": { + "id": "R56984", + "label": "Other resource", + "created_at": "2022-02-22T08:01:12.709843+01:00", + "classes": [ + "Entry" + ], + "shared": 1, + "created_by": "d5416c16-1a45-4aee-8069-be1b6097478b", + "_class": "resource", + "observatory_id": "00000000-0000-0000-0000-000000000000", + "extraction_method": "MANUAL", + "organization_id": "00000000-0000-0000-0000-000000000000", + "visibility": "FEATURED" + }, + "predicate": { + "id": "HasPaper", + "label": "has paper", + "created_at": "2021-04-26T16:57:34.745465+02:00", + "created_by": "00000000-0000-0000-0000-000000000000", + "_class": "predicate", + "description": null + }, + "object": { + "id": "L354354", + "label": "Some literal", + "created_at": "2022-02-22T08:01:12.709843+01:00", + "created_by": "d5416c16-1a45-4aee-8069-be1b6097478b", + "_class": "literal", + "datatype": "xsd:string" + }, + "created_at": "2023-02-22T08:01:15.253502+01:00", + "created_by": "d5416c16-1a45-4aee-8069-be1b6097478b" + } + ] + } + } + } +} diff --git a/content-types/content-types-adapter-output-web/src/test/kotlin/org/orkg/contenttypes/adapter/output/web/DataCiteDoiServiceAdapterUnitTest.kt b/content-types/content-types-adapter-output-web/src/test/kotlin/org/orkg/contenttypes/adapter/output/web/DataCiteDoiServiceAdapterUnitTest.kt index 91675707c..1fb1c410a 100644 --- a/content-types/content-types-adapter-output-web/src/test/kotlin/org/orkg/contenttypes/adapter/output/web/DataCiteDoiServiceAdapterUnitTest.kt +++ b/content-types/content-types-adapter-output-web/src/test/kotlin/org/orkg/contenttypes/adapter/output/web/DataCiteDoiServiceAdapterUnitTest.kt @@ -17,6 +17,8 @@ import java.net.http.HttpResponse import java.util.* import org.junit.jupiter.api.Test import org.orkg.common.exceptions.ServiceUnavailable +import org.orkg.common.testing.fixtures.Assets.requestJson +import org.orkg.common.testing.fixtures.Assets.responseJson import org.orkg.common.testing.fixtures.MockkBaseTest import org.orkg.common.testing.fixtures.TestBodyPublisher import org.orkg.common.testing.fixtures.fixedClock @@ -41,7 +43,7 @@ internal class DataCiteDoiServiceAdapterUnitTest : MockkBaseTest { val dataCitePrefix = "10.7484" val encodedCredentials = Base64.getEncoder().encodeToString("username:password".toByteArray()) // Deserialize and serialize json to remove formatting - val json = objectMapper.writeValueAsString(objectMapper.readTree(dataCiteRequestJson)) + val json = objectMapper.writeValueAsString(objectMapper.readTree(requestJson("datacite/registerDoi"))) every { dataciteConfiguration.publish } returns "draft" every { dataciteConfiguration.url } returns dataCiteUri @@ -95,7 +97,7 @@ internal class DataCiteDoiServiceAdapterUnitTest : MockkBaseTest { every { dataciteConfiguration.encodedCredentials } returns encodedCredentials every { httpClient.send(any(), any>()) } returns response every { response.statusCode() } returns 500 - every { response.body() } returns dataCiteErrorResponseJson + every { response.body() } returns responseJson("datacite/internalServerError") shouldThrow { adapter.register(command) @@ -113,80 +115,3 @@ internal class DataCiteDoiServiceAdapterUnitTest : MockkBaseTest { verify(exactly = 1) { response.body() } } } - -private const val dataCiteRequestJson = """ -{ - "data": { - "attributes": { - "doi": "10.7484/182", - "event": "draft", - "creators": [ - { - "name": "Josiah Stinkney Carberry", - "nameIdentifiers": [ - { - "schemeUri": "https://orcid.org", - "nameIdentifier": "https://orcid.org/0000-0002-1825-0097", - "nameIdentifierScheme": "ORCID" - } - ], - "nameType":"Personal" - }, - { - "name": "Author 2", - "nameIdentifiers": [], - "nameType": "Personal" - } - ], - "titles": [ - { - "title": "Paper title", - "lang": "en" - } - ], - "publicationYear": 2023, - "subjects": [ - { - "subject": "Paper subject", - "lang": "en" - } - ], - "types": { - "resourceType": "Paper", - "resourceTypeGeneral": "Dataset" - }, - "relatedIdentifiers": [ - { - "relatedIdentifier": "https://doi.org/10.48366/r609337", - "relatedIdentifierType": "DOI", - "relationType": "IsVariantFormOf" - } - ], - "rightsList": [ - { - "rights": "Creative Commons Attribution-ShareAlike 4.0 International License.", - "rightsUri": "https://creativecommons.org/licenses/by-sa/4.0/" - } - ], - "descriptions": [ - { - "description": "Description of the paper", - "descriptionType": "Abstract" - } - ], - "url": "https://example.org", - "language": "en", - "publisher": "Open Research Knowledge Graph" - }, - "type": "dois" - } -}""" - -private const val dataCiteErrorResponseJson = """{ - "errors": [ - { - "status": "500", - "title": "Internal error" - } - ] -}""" diff --git a/content-types/content-types-adapter-output-web/src/test/resources/assets/requests/datacite/registerDoi.json b/content-types/content-types-adapter-output-web/src/test/resources/assets/requests/datacite/registerDoi.json new file mode 100644 index 000000000..2fe1bd667 --- /dev/null +++ b/content-types/content-types-adapter-output-web/src/test/resources/assets/requests/datacite/registerDoi.json @@ -0,0 +1,66 @@ +{ + "data": { + "attributes": { + "doi": "10.7484/182", + "event": "draft", + "creators": [ + { + "name": "Josiah Stinkney Carberry", + "nameIdentifiers": [ + { + "schemeUri": "https://orcid.org", + "nameIdentifier": "https://orcid.org/0000-0002-1825-0097", + "nameIdentifierScheme": "ORCID" + } + ], + "nameType":"Personal" + }, + { + "name": "Author 2", + "nameIdentifiers": [], + "nameType": "Personal" + } + ], + "titles": [ + { + "title": "Paper title", + "lang": "en" + } + ], + "publicationYear": 2023, + "subjects": [ + { + "subject": "Paper subject", + "lang": "en" + } + ], + "types": { + "resourceType": "Paper", + "resourceTypeGeneral": "Dataset" + }, + "relatedIdentifiers": [ + { + "relatedIdentifier": "https://doi.org/10.48366/r609337", + "relatedIdentifierType": "DOI", + "relationType": "IsVariantFormOf" + } + ], + "rightsList": [ + { + "rights": "Creative Commons Attribution-ShareAlike 4.0 International License.", + "rightsUri": "https://creativecommons.org/licenses/by-sa/4.0/" + } + ], + "descriptions": [ + { + "description": "Description of the paper", + "descriptionType": "Abstract" + } + ], + "url": "https://example.org", + "language": "en", + "publisher": "Open Research Knowledge Graph" + }, + "type": "dois" + } +} diff --git a/content-types/content-types-adapter-output-web/src/test/resources/assets/responses/datacite/internalServerError.json b/content-types/content-types-adapter-output-web/src/test/resources/assets/responses/datacite/internalServerError.json new file mode 100644 index 000000000..e55026ddc --- /dev/null +++ b/content-types/content-types-adapter-output-web/src/test/resources/assets/responses/datacite/internalServerError.json @@ -0,0 +1,8 @@ +{ + "errors": [ + { + "status": "500", + "title": "Internal error" + } + ] +} diff --git a/data-export/data-export-core/src/test/kotlin/org/orkg/export/domain/ExportComparisonServiceIntegrationTest.kt b/data-export/data-export-core/src/test/kotlin/org/orkg/export/domain/ExportComparisonServiceIntegrationTest.kt index 679557303..0535e5d32 100644 --- a/data-export/data-export-core/src/test/kotlin/org/orkg/export/domain/ExportComparisonServiceIntegrationTest.kt +++ b/data-export/data-export-core/src/test/kotlin/org/orkg/export/domain/ExportComparisonServiceIntegrationTest.kt @@ -8,6 +8,7 @@ import io.mockk.mockk import io.mockk.verify import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext +import org.orkg.common.testing.fixtures.Assets.requestJson import org.orkg.common.testing.fixtures.MockkDescribeSpec import org.orkg.contenttypes.domain.testing.fixtures.createComparison import org.orkg.contenttypes.input.ComparisonUseCases @@ -47,84 +48,13 @@ internal class ExportComparisonServiceIntegrationTest : MockkDescribeSpec({ service.export(targetFile.absolutePath) } + val responseJsonL = requestJson("datacite/registerComparisonDoi").toJsonL() + it("writes the correct result") { targetFile.exists() shouldBe true - targetFile.readText() shouldBe (dummyComparisonDataCiteJson.toJsonL() + dummyComparisonDataCiteJson.toJsonL()) + targetFile.readText() shouldBe (responseJsonL + responseJsonL) verify(exactly = 1) { comparisonService.findAllCurrentAndListedAndUnpublishedComparisons(any()) } verify(exactly = 2) { comparisonRepository.findAllDOIsRelatedToComparison(comparison.id) } } } }) - -private const val dummyComparisonDataCiteJson = """ -{ - "data": { - "attributes": { - "creators": [ - { - "name": "Josiah Stinkney Carberry", - "nameIdentifiers": [ - { - "schemeUri": "https://orcid.org", - "nameIdentifier": "https://orcid.org/0000-0002-1825-0097", - "nameIdentifierScheme": "ORCID" - } - ], - "nameType": "Personal" - }, - { - "name": "Author 2", - "nameIdentifiers": [ - - ], - "nameType": "Personal" - } - ], - "titles": [ - { - "title": "Dummy Comparison Title", - "lang": "en" - } - ], - "publicationYear": 2023, - "subjects": [ - { - "subject": "Research Field 1", - "lang": "en" - }, - { - "subject": "Research Field 2", - "lang": "en" - } - ], - "types": { - "resourceType": "Comparison", - "resourceTypeGeneral": "Dataset" - }, - "relatedIdentifiers": [ - { - "relatedIdentifier": "https://doi.org/test/doi", - "relatedIdentifierType": "DOI", - "relationType": "IsVariantFormOf" - } - ], - "rightsList": [ - { - "rights": "Creative Commons Attribution-ShareAlike 4.0 International License.", - "rightsUri": "https://creativecommons.org/licenses/by-sa/4.0/" - } - ], - "descriptions": [ - { - "description": "Some description about the contents", - "descriptionType": "Abstract" - } - ], - "url": "https://orkg.org/comparison/R8186", - "language": "en", - "publisher": "Open Research Knowledge Graph" - }, - "type": "dois" - } -} -""" diff --git a/data-export/data-export-core/src/test/resources/assets/requests/datacite/registerComparisonDoi.json b/data-export/data-export-core/src/test/resources/assets/requests/datacite/registerComparisonDoi.json new file mode 100644 index 000000000..27a287265 --- /dev/null +++ b/data-export/data-export-core/src/test/resources/assets/requests/datacite/registerComparisonDoi.json @@ -0,0 +1,70 @@ +{ + "data": { + "attributes": { + "creators": [ + { + "name": "Josiah Stinkney Carberry", + "nameIdentifiers": [ + { + "schemeUri": "https://orcid.org", + "nameIdentifier": "https://orcid.org/0000-0002-1825-0097", + "nameIdentifierScheme": "ORCID" + } + ], + "nameType": "Personal" + }, + { + "name": "Author 2", + "nameIdentifiers": [ + + ], + "nameType": "Personal" + } + ], + "titles": [ + { + "title": "Dummy Comparison Title", + "lang": "en" + } + ], + "publicationYear": 2023, + "subjects": [ + { + "subject": "Research Field 1", + "lang": "en" + }, + { + "subject": "Research Field 2", + "lang": "en" + } + ], + "types": { + "resourceType": "Comparison", + "resourceTypeGeneral": "Dataset" + }, + "relatedIdentifiers": [ + { + "relatedIdentifier": "https://doi.org/test/doi", + "relatedIdentifierType": "DOI", + "relationType": "IsVariantFormOf" + } + ], + "rightsList": [ + { + "rights": "Creative Commons Attribution-ShareAlike 4.0 International License.", + "rightsUri": "https://creativecommons.org/licenses/by-sa/4.0/" + } + ], + "descriptions": [ + { + "description": "Some description about the contents", + "descriptionType": "Abstract" + } + ], + "url": "https://orkg.org/comparison/R8186", + "language": "en", + "publisher": "Open Research Knowledge Graph" + }, + "type": "dois" + } +} diff --git a/graph/graph-adapter-output-web/src/test/kotlin/org/orkg/graph/adapter/output/web/GeoNamesRepositoryAdapterUnitTest.kt b/graph/graph-adapter-output-web/src/test/kotlin/org/orkg/graph/adapter/output/web/GeoNamesRepositoryAdapterUnitTest.kt index 36119d63e..5bdfde738 100644 --- a/graph/graph-adapter-output-web/src/test/kotlin/org/orkg/graph/adapter/output/web/GeoNamesRepositoryAdapterUnitTest.kt +++ b/graph/graph-adapter-output-web/src/test/kotlin/org/orkg/graph/adapter/output/web/GeoNamesRepositoryAdapterUnitTest.kt @@ -20,6 +20,7 @@ import org.junit.jupiter.params.provider.Arguments import org.junit.jupiter.params.provider.MethodSource import org.orkg.common.exceptions.ServiceUnavailable import org.orkg.common.json.CommonJacksonModule +import org.orkg.common.testing.fixtures.Assets.responseJson import org.orkg.common.testing.fixtures.MockkBaseTest import org.orkg.graph.adapter.input.rest.json.GraphJacksonModule import org.orkg.graph.domain.ExternalThing @@ -155,7 +156,7 @@ internal class GeoNamesRepositoryAdapterUnitTest : MockkBaseTest { "2950159", "2950159", GeoNamesServiceAdapter::findResourceByShortForm, - geonamesSuccessResponseJson, + responseJson("geonames/citySuccess"), ExternalThing( uri = ParsedIRI("https://sws.geonames.org/2950159"), label = "Berlin", @@ -166,7 +167,7 @@ internal class GeoNamesRepositoryAdapterUnitTest : MockkBaseTest { "2950159", ParsedIRI("https://sws.geonames.org/2950159"), GeoNamesServiceAdapter::findResourceByURI, - geonamesSuccessResponseJson, + responseJson("geonames/citySuccess"), ExternalThing( uri = ParsedIRI("https://sws.geonames.org/2950159"), label = "Berlin", @@ -184,63 +185,3 @@ internal class GeoNamesRepositoryAdapterUnitTest : MockkBaseTest { ) } } - -private const val geonamesSuccessResponseJson = """{ - "timezone": { - "gmtOffset": 1, - "timeZoneId": "Europe/Berlin", - "dstOffset": 2 - }, - "bbox": { - "east": 13.7604692835498, - "south": 52.3382418348765, - "north": 52.6749171487584, - "west": 13.0883332178678, - "accuracyLevel": 0 - }, - "asciiName": "Berlin", - "astergdem": 52, - "countryId": "2921044", - "fcl": "P", - "srtm3": 43, - "adminId3": "6547383", - "countryCode": "DE", - "adminId4": "6547539", - "adminCodes1": { - "ISO3166_2": "BE" - }, - "adminId1": "2950157", - "lat": "52.52437", - "fcode": "PPLC", - "continentCode": "EU", - "elevation": 74, - "adminCode2": "00", - "adminCode3": "11000", - "adminCode1": "16", - "lng": "13.41053", - "geonameId": 2950159, - "toponymName": "Berlin", - "adminCode4": "11000000", - "population": 3426354, - "wikipediaURL": "en.wikipedia.org/wiki/Berlin", - "adminName5": "", - "adminName4": "Berlin", - "adminName3": "Berlin, Stadt", - "alternateNames": [ - { - "isPreferredName": true, - "name": "Berlin", - "lang": "de" - }, - { - "name": "Berlin", - "lang": "en" - } - ], - "adminName2": "", - "name": "Berlin", - "fclName": "city, village,...", - "countryName": "Germany", - "fcodeName": "capital of a political entity", - "adminName1": "Berlin" -}""" diff --git a/graph/graph-adapter-output-web/src/test/kotlin/org/orkg/graph/adapter/output/web/OLSRepositoryAdapterUnitTest.kt b/graph/graph-adapter-output-web/src/test/kotlin/org/orkg/graph/adapter/output/web/OLSRepositoryAdapterUnitTest.kt index 0a517dc06..9e80d3aa0 100644 --- a/graph/graph-adapter-output-web/src/test/kotlin/org/orkg/graph/adapter/output/web/OLSRepositoryAdapterUnitTest.kt +++ b/graph/graph-adapter-output-web/src/test/kotlin/org/orkg/graph/adapter/output/web/OLSRepositoryAdapterUnitTest.kt @@ -16,13 +16,13 @@ import java.net.http.HttpClient import java.net.http.HttpResponse import java.util.stream.Stream import org.eclipse.rdf4j.common.net.ParsedIRI -import org.intellij.lang.annotations.Language import org.junit.jupiter.api.assertThrows import org.junit.jupiter.params.ParameterizedTest import org.junit.jupiter.params.provider.Arguments import org.junit.jupiter.params.provider.MethodSource import org.orkg.common.exceptions.ServiceUnavailable import org.orkg.common.json.CommonJacksonModule +import org.orkg.common.testing.fixtures.Assets.responseJson import org.orkg.common.testing.fixtures.MockkBaseTest import org.orkg.graph.adapter.input.rest.json.GraphJacksonModule import org.orkg.graph.domain.ExternalThing @@ -176,7 +176,7 @@ internal class OLSRepositoryAdapterUnitTest : MockkBaseTest { "AbsenceObservation", "abcd", OLSServiceAdapter::findResourceByShortForm, - olsIndividualSuccessResponseJson, + responseJson("ols/individualSuccess"), ExternalThing( uri = ParsedIRI("http://rs.tdwg.org/abcd/terms/AbsenceObservation"), label = "AbsenceObservation", @@ -188,7 +188,7 @@ internal class OLSRepositoryAdapterUnitTest : MockkBaseTest { ParsedIRI("http://rs.tdwg.org/abcd/terms/AbsenceObservation"), "abcd", OLSServiceAdapter::findResourceByURI, - olsIndividualSuccessResponseJson, + responseJson("ols/individualSuccess"), ExternalThing( uri = ParsedIRI("http://rs.tdwg.org/abcd/terms/AbsenceObservation"), label = "AbsenceObservation", @@ -200,7 +200,7 @@ internal class OLSRepositoryAdapterUnitTest : MockkBaseTest { "Collection", "skos", OLSServiceAdapter::findClassByShortForm, - olsTermSuccessResponseJson, + responseJson("ols/termSuccess"), ExternalThing( uri = ParsedIRI("http://www.w3.org/2004/02/skos/core#Collection"), label = "Collection", @@ -212,7 +212,7 @@ internal class OLSRepositoryAdapterUnitTest : MockkBaseTest { ParsedIRI("https://sws.geonames.org/2950159"), "skos", OLSServiceAdapter::findClassByURI, - olsTermSuccessResponseJson, + responseJson("ols/termSuccess"), ExternalThing( uri = ParsedIRI("http://www.w3.org/2004/02/skos/core#Collection"), label = "Collection", @@ -224,7 +224,7 @@ internal class OLSRepositoryAdapterUnitTest : MockkBaseTest { "hasCountry", "abcd", OLSServiceAdapter::findPredicateByShortForm, - olsPropertySuccessResponseJson, + responseJson("ols/propertySuccess"), ExternalThing( uri = ParsedIRI("http://rs.tdwg.org/abcd/terms/hasCountry"), label = "has Country", @@ -236,7 +236,7 @@ internal class OLSRepositoryAdapterUnitTest : MockkBaseTest { ParsedIRI("http://rs.tdwg.org/abcd/terms/hasCountry"), "abcd", OLSServiceAdapter::findPredicateByURI, - olsPropertySuccessResponseJson, + responseJson("ols/propertySuccess"), ExternalThing( uri = ParsedIRI("http://rs.tdwg.org/abcd/terms/hasCountry"), label = "has Country", @@ -256,554 +256,3 @@ internal class OLSRepositoryAdapterUnitTest : MockkBaseTest { ) } } - -private const val olsIndividualSuccessResponseJson = """{ - "page": 0, - "numElements": 1, - "totalPages": 1, - "totalElements": 1, - "elements": [ - { - "appearsIn": [ - "abcd" - ], - "curie": "AbsenceObservation", - "definedBy": [ - "abcd" - ], - "definition": [ - "A record describing an output of an observation process with indication of the absence of an observation", - "A record describing an output of an observation process with indication of the absence of an observation" - ], - "definitionProperty": [ - "http://www.w3.org/2000/01/rdf-schema#comment", - "http://www.w3.org/2004/02/skos/core#definition" - ], - "directAncestor": [ - "http://rs.tdwg.org/abcd/terms/RecordBasis" - ], - "directParent": [ - "http://rs.tdwg.org/abcd/terms/RecordBasis" - ], - "hasDirectChildren": false, - "hasDirectParents": true, - "hasHierarchicalChildren": false, - "hasHierarchicalParents": false, - "imported": false, - "iri": "http://rs.tdwg.org/abcd/terms/AbsenceObservation", - "isDefiningOntology": true, - "isObsolete": false, - "label": [ - "AbsenceObservation" - ], - "linkedEntities": { - "http://www.w3.org/2004/02/skos/core#definition": { - "definedBy": [ - "stw", - "skos" - ], - "numAppearsIn": 31, - "hasLocalDefinition": true, - "label": [ - "definition" - ], - "curie": "definition", - "type": [ - "property", - "annotationProperty", - "entity" - ] - }, - "http://www.w3.org/2000/01/rdf-schema#comment": { - "definedBy": [ - "prov" - ], - "numAppearsIn": 53, - "hasLocalDefinition": false, - "label": [ - "comment" - ], - "curie": "comment", - "type": [ - "property", - "annotationProperty", - "entity" - ] - }, - "http://purl.org/dc/terms/modified": { - "definedBy": [ - "dcterms" - ], - "numAppearsIn": 43, - "hasLocalDefinition": true, - "label": [ - "Date Modified" - ], - "curie": "dcterms:/modified", - "type": [ - "dataProperty", - "property", - "entity" - ] - }, - "http://rs.tdwg.org/dwc/terms/attributes/status": { - "numAppearsIn": 2, - "hasLocalDefinition": true, - "label": [ - "status" - ], - "curie": "status", - "type": [ - "property", - "annotationProperty", - "entity" - ] - }, - "http://www.w3.org/2000/01/rdf-schema#isDefinedBy": { - "numAppearsIn": 25, - "hasLocalDefinition": false, - "type": [ - "property", - "annotationProperty", - "entity" - ], - "label": [ - "isDefinedBy" - ], - "curie": "isDefinedBy" - }, - "http://purl.org/dc/terms/issued": { - "definedBy": [ - "dcterms" - ], - "numAppearsIn": 35, - "hasLocalDefinition": true, - "label": [ - "Date Issued" - ], - "curie": "dcterms:/issued", - "type": [ - "dataProperty", - "property", - "entity" - ] - }, - "http://rs.tdwg.org/abcd/terms/RecordBasis": { - "definedBy": [ - "abcd" - ], - "numAppearsIn": 1, - "hasLocalDefinition": true, - "label": [ - "Record Basis" - ], - "curie": "RecordBasis", - "type": [ - "class", - "entity" - ] - } - }, - "numDescendants": 0, - "numHierarchicalDescendants": 0, - "ontologyId": "abcd", - "ontologyIri": "http://rs.tdwg.org/abcd/terms/", - "ontologyPreferredPrefix": "abcd", - "searchableAnnotationValues": [ - false - ], - "shortForm": "AbsenceObservation", - "type": [ - "individual", - "entity" - ], - "http://purl.org/dc/terms/issued": "2019-01-31", - "http://purl.org/dc/terms/modified": "2019-01-31", - "http://rs.tdwg.org/dwc/terms/attributes/status": "recommended", - "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": [ - "http://www.w3.org/2002/07/owl#NamedIndividual", - "http://rs.tdwg.org/abcd/terms/RecordBasis" - ], - "http://www.w3.org/2000/01/rdf-schema#comment": "A record describing an output of an observation process with indication of the absence of an observation", - "http://www.w3.org/2000/01/rdf-schema#isDefinedBy": "http://rs.tdwg.org/abcd/terms/", - "http://www.w3.org/2004/02/skos/core#definition": "A record describing an output of an observation process with indication of the absence of an observation" - } - ], - "facetFieldsToCounts": {} -}""" - -@Language("JSON") -private const val olsTermSuccessResponseJson = """{ - "page": 0, - "numElements": 1, - "totalPages": 1, - "totalElements": 1, - "elements": [ - { - "appearsIn": [ - "cf", - "meth", - "afo", - "skos", - "stw", - "linsearch", - "modsci", - "skosxl" - ], - "curie": "Collection", - "definedBy": [ - "stw", - "skos" - ], - "definition": [ - "A meaningful collection of concepts." - ], - "definitionProperty": "http://www.w3.org/2004/02/skos/core#definition", - "hasDirectChildren": true, - "hasDirectParents": false, - "hasHierarchicalChildren": true, - "hasHierarchicalParents": false, - "imported": false, - "iri": "http://www.w3.org/2004/02/skos/core#Collection", - "isDefiningOntology": true, - "isObsolete": false, - "isPreferredRoot": false, - "label": [ - "Collection" - ], - "linkedEntities": { - "http://www.w3.org/2004/02/skos/core#definition": { - "definedBy": [ - "stw", - "skos" - ], - "numAppearsIn": 31, - "hasLocalDefinition": true, - "label": [ - "definition" - ], - "curie": "definition", - "type": [ - "property", - "annotationProperty", - "entity" - ] - }, - "http://www.w3.org/2004/02/skos/core#Concept": { - "definedBy": [ - "stw", - "skos" - ], - "numAppearsIn": 14, - "hasLocalDefinition": true, - "label": [ - "Concept" - ], - "curie": "Concept", - "type": [ - "class", - "entity" - ] - }, - "http://www.w3.org/2004/02/skos/core#scopeNote": { - "definedBy": [ - "stw", - "skos" - ], - "numAppearsIn": 18, - "hasLocalDefinition": true, - "label": [ - "scope note" - ], - "curie": "scopeNote", - "type": [ - "property", - "annotationProperty", - "entity" - ] - }, - "http://www.w3.org/2000/01/rdf-schema#isDefinedBy": { - "numAppearsIn": 25, - "hasLocalDefinition": false, - "type": [ - "property", - "annotationProperty", - "entity" - ], - "label": [ - "isDefinedBy" - ], - "curie": "isDefinedBy" - }, - "http://www.w3.org/2004/02/skos/core#ConceptScheme": { - "definedBy": [ - "stw", - "skos" - ], - "numAppearsIn": 11, - "hasLocalDefinition": true, - "label": [ - "Concept Scheme" - ], - "curie": "ConceptScheme", - "type": [ - "class", - "entity" - ] - }, - "http://www.w3.org/2000/01/rdf-schema#label": { - "definedBy": [ - "prov" - ], - "numAppearsIn": 53, - "hasLocalDefinition": false, - "label": [ - "label" - ], - "curie": "label", - "type": [ - "property", - "annotationProperty", - "entity" - ] - } - }, - "numDescendants": 1, - "numHierarchicalDescendants": 1, - "ontologyId": "skos", - "ontologyIri": "http://www.w3.org/2004/02/skos/core", - "ontologyPreferredPrefix": "SKOS", - "searchableAnnotationValues": [ - "A meaningful collection of concepts.", - "Labelled collections can be used where you would like a set of concepts to be displayed under a 'node label' in the hierarchy.", - false - ], - "shortForm": "Collection", - "type": [ - "class", - "entity" - ], - "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": "http://www.w3.org/2002/07/owl#Class", - "http://www.w3.org/2000/01/rdf-schema#isDefinedBy": "http://www.w3.org/2004/02/skos/core", - "http://www.w3.org/2000/01/rdf-schema#label": "Collection", - "http://www.w3.org/2002/07/owl#disjointWith": [ - "http://www.w3.org/2004/02/skos/core#Concept", - "http://www.w3.org/2004/02/skos/core#ConceptScheme" - ], - "http://www.w3.org/2004/02/skos/core#definition": "A meaningful collection of concepts.", - "http://www.w3.org/2004/02/skos/core#scopeNote": "Labelled collections can be used where you would like a set of concepts to be displayed under a 'node label' in the hierarchy." - } - ], - "facetFieldsToCounts": {} -}""" - -private const val olsPropertySuccessResponseJson = """{ - "page": 0, - "numElements": 1, - "totalPages": 1, - "totalElements": 1, - "elements": [ - { - "appearsIn": [ - "abcd" - ], - "curie": "hasCountry", - "definedBy": [ - "abcd" - ], - "definition": [ - "Property to connect an instance of a class to a Country.", - "Property to connect an instance of a class to a Country." - ], - "definitionProperty": [ - "http://www.w3.org/2000/01/rdf-schema#comment", - "http://www.w3.org/2004/02/skos/core#definition" - ], - "hasDirectChildren": false, - "hasDirectParents": false, - "hasHierarchicalChildren": false, - "hasHierarchicalParents": false, - "imported": false, - "iri": "http://rs.tdwg.org/abcd/terms/hasCountry", - "isDefiningOntology": true, - "isObsolete": false, - "isPreferredRoot": false, - "label": [ - "has Country" - ], - "linkedEntities": { - "http://www.w3.org/2004/02/skos/core#definition": { - "definedBy": [ - "stw", - "skos" - ], - "numAppearsIn": 31, - "hasLocalDefinition": true, - "label": [ - "definition" - ], - "curie": "definition", - "type": [ - "property", - "annotationProperty", - "entity" - ] - }, - "http://rs.tdwg.org/dwc/terms/attributes/status": { - "numAppearsIn": 2, - "hasLocalDefinition": true, - "label": [ - "status" - ], - "curie": "status", - "type": [ - "property", - "annotationProperty", - "entity" - ] - }, - "http://www.w3.org/2000/01/rdf-schema#range": { - "numAppearsIn": 1, - "hasLocalDefinition": false, - "type": [ - "property", - "entity" - ], - "label": [ - "range" - ], - "curie": "range" - }, - "http://www.w3.org/2000/01/rdf-schema#isDefinedBy": { - "numAppearsIn": 25, - "hasLocalDefinition": false, - "type": [ - "property", - "annotationProperty", - "entity" - ], - "label": [ - "isDefinedBy" - ], - "curie": "isDefinedBy" - }, - "http://rs.tdwg.org/abcd/terms/Country": { - "definedBy": [ - "abcd" - ], - "numAppearsIn": 1, - "hasLocalDefinition": true, - "label": [ - "Country" - ], - "curie": "Country", - "type": [ - "class", - "entity" - ] - }, - "http://www.w3.org/2000/01/rdf-schema#comment": { - "definedBy": [ - "prov" - ], - "numAppearsIn": 53, - "hasLocalDefinition": false, - "label": [ - "comment" - ], - "curie": "comment", - "type": [ - "property", - "annotationProperty", - "entity" - ] - }, - "http://purl.org/dc/terms/modified": { - "definedBy": [ - "dcterms" - ], - "numAppearsIn": 43, - "hasLocalDefinition": true, - "label": [ - "Date Modified" - ], - "curie": "dcterms:/modified", - "type": [ - "dataProperty", - "property", - "entity" - ] - }, - "http://www.w3.org/2000/01/rdf-schema#domain": { - "numAppearsIn": 1, - "hasLocalDefinition": false, - "type": [ - "property", - "entity" - ], - "label": [ - "domain" - ], - "curie": "domain" - }, - "http://purl.org/dc/terms/issued": { - "definedBy": [ - "dcterms" - ], - "numAppearsIn": 35, - "hasLocalDefinition": true, - "label": [ - "Date Issued" - ], - "curie": "dcterms:/issued", - "type": [ - "dataProperty", - "property", - "entity" - ] - }, - "http://www.w3.org/2000/01/rdf-schema#label": { - "definedBy": [ - "prov" - ], - "numAppearsIn": 53, - "hasLocalDefinition": false, - "label": [ - "label" - ], - "curie": "label", - "type": [ - "property", - "annotationProperty", - "entity" - ] - } - }, - "numDescendants": 0, - "numHierarchicalDescendants": 0, - "ontologyId": "abcd", - "ontologyIri": "http://rs.tdwg.org/abcd/terms/", - "ontologyPreferredPrefix": "abcd", - "searchableAnnotationValues": [ - false - ], - "shortForm": "hasCountry", - "type": [ - "property", - "objectProperty", - "entity" - ], - "http://purl.org/dc/terms/issued": "2019-01-31", - "http://purl.org/dc/terms/modified": "2019-01-31", - "http://rs.tdwg.org/dwc/terms/attributes/status": "recommended", - "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": "http://www.w3.org/2002/07/owl#ObjectProperty", - "http://www.w3.org/2000/01/rdf-schema#comment": "Property to connect an instance of a class to a Country.", - "http://www.w3.org/2000/01/rdf-schema#domain": "http://www.w3.org/2002/07/owl#Thing", - "http://www.w3.org/2000/01/rdf-schema#isDefinedBy": "http://rs.tdwg.org/abcd/terms/", - "http://www.w3.org/2000/01/rdf-schema#label": "has Country", - "http://www.w3.org/2000/01/rdf-schema#range": "http://rs.tdwg.org/abcd/terms/Country", - "http://www.w3.org/2004/02/skos/core#definition": "Property to connect an instance of a class to a Country." - } - ], - "facetFieldsToCounts": {} -}""" diff --git a/graph/graph-adapter-output-web/src/test/kotlin/org/orkg/graph/adapter/output/web/WikidataRepositoryAdapterUnitTest.kt b/graph/graph-adapter-output-web/src/test/kotlin/org/orkg/graph/adapter/output/web/WikidataRepositoryAdapterUnitTest.kt index b4859badc..6c98bbe3f 100644 --- a/graph/graph-adapter-output-web/src/test/kotlin/org/orkg/graph/adapter/output/web/WikidataRepositoryAdapterUnitTest.kt +++ b/graph/graph-adapter-output-web/src/test/kotlin/org/orkg/graph/adapter/output/web/WikidataRepositoryAdapterUnitTest.kt @@ -20,6 +20,7 @@ import org.junit.jupiter.params.provider.Arguments import org.junit.jupiter.params.provider.MethodSource import org.orkg.common.exceptions.ServiceUnavailable import org.orkg.common.json.CommonJacksonModule +import org.orkg.common.testing.fixtures.Assets.responseJson import org.orkg.common.testing.fixtures.MockkBaseTest import org.orkg.graph.adapter.input.rest.json.GraphJacksonModule import org.orkg.graph.domain.ExternalThing @@ -159,8 +160,8 @@ internal class WikidataRepositoryAdapterUnitTest : MockkBaseTest { "Q42", "Q42", WikidataServiceAdapter::findResourceByShortForm, - wikidataItemSuccessResponseJson, - wikidataNotFoundResponseJson, + responseJson("wikidata/itemSuccess"), + responseJson("wikidata/entityNotFound"), ExternalThing( uri = ParsedIRI("https://www.wikidata.org/entity/Q42"), label = "Douglas Adams", @@ -171,8 +172,8 @@ internal class WikidataRepositoryAdapterUnitTest : MockkBaseTest { "Q42", "Q42", WikidataServiceAdapter::findClassByShortForm, - wikidataItemSuccessResponseJson, - wikidataNotFoundResponseJson, + responseJson("wikidata/itemSuccess"), + responseJson("wikidata/entityNotFound"), ExternalThing( uri = ParsedIRI("https://www.wikidata.org/entity/Q42"), label = "Douglas Adams", @@ -183,8 +184,8 @@ internal class WikidataRepositoryAdapterUnitTest : MockkBaseTest { "P30", "P30", WikidataServiceAdapter::findPredicateByShortForm, - wikidataPropertySuccessResponseJson, - wikidataNotFoundResponseJson, + responseJson("wikidata/propertySuccess"), + responseJson("wikidata/entityNotFound"), ExternalThing( uri = ParsedIRI("https://www.wikidata.org/entity/P30"), label = "continent", @@ -195,8 +196,8 @@ internal class WikidataRepositoryAdapterUnitTest : MockkBaseTest { "Q42", ParsedIRI("https://www.wikidata.org/entity/Q42"), WikidataServiceAdapter::findResourceByURI, - wikidataItemSuccessResponseJson, - wikidataNotFoundResponseJson, + responseJson("wikidata/itemSuccess"), + responseJson("wikidata/entityNotFound"), ExternalThing( uri = ParsedIRI("https://www.wikidata.org/entity/Q42"), label = "Douglas Adams", @@ -207,8 +208,8 @@ internal class WikidataRepositoryAdapterUnitTest : MockkBaseTest { "Q42", ParsedIRI("https://www.wikidata.org/entity/Q42"), WikidataServiceAdapter::findClassByURI, - wikidataItemSuccessResponseJson, - wikidataNotFoundResponseJson, + responseJson("wikidata/itemSuccess"), + responseJson("wikidata/entityNotFound"), ExternalThing( uri = ParsedIRI("https://www.wikidata.org/entity/Q42"), label = "Douglas Adams", @@ -219,8 +220,8 @@ internal class WikidataRepositoryAdapterUnitTest : MockkBaseTest { "P30", ParsedIRI("https://www.wikidata.org/entity/P30"), WikidataServiceAdapter::findPredicateByURI, - wikidataPropertySuccessResponseJson, - wikidataNotFoundResponseJson, + responseJson("wikidata/propertySuccess"), + responseJson("wikidata/entityNotFound"), ExternalThing( uri = ParsedIRI("https://www.wikidata.org/entity/P30"), label = "continent", @@ -231,8 +232,8 @@ internal class WikidataRepositoryAdapterUnitTest : MockkBaseTest { "Q42", "Q42", WikidataServiceAdapter::findResourceByShortForm, - wikidataResourceSuccessResponseJson, - wikidataClassSuccessResponseJson, // should fail, because response contains a class and not a resource + responseJson("wikidata/resourceSuccess"), + responseJson("wikidata/classSuccess"), // should fail, because response contains a class and not a resource ExternalThing( uri = ParsedIRI("https://www.wikidata.org/entity/Q42"), label = "Douglas Adams", @@ -243,8 +244,8 @@ internal class WikidataRepositoryAdapterUnitTest : MockkBaseTest { "Q42", "Q42", WikidataServiceAdapter::findClassByShortForm, - wikidataClassSuccessResponseJson, - wikidataResourceSuccessResponseJson, // should fail, because response contains a resource and not a class + responseJson("wikidata/classSuccess"), + responseJson("wikidata/resourceSuccess"), // should fail, because response contains a resource and not a class ExternalThing( uri = ParsedIRI("https://www.wikidata.org/entity/Q42"), label = "Douglas Adams", @@ -255,8 +256,8 @@ internal class WikidataRepositoryAdapterUnitTest : MockkBaseTest { "Q42", ParsedIRI("https://www.wikidata.org/entity/Q42"), WikidataServiceAdapter::findResourceByURI, - wikidataResourceSuccessResponseJson, - wikidataClassSuccessResponseJson, // should fail, because response contains a class and not a resource + responseJson("wikidata/resourceSuccess"), + responseJson("wikidata/classSuccess"), // should fail, because response contains a class and not a resource ExternalThing( uri = ParsedIRI("https://www.wikidata.org/entity/Q42"), label = "Douglas Adams", @@ -267,8 +268,8 @@ internal class WikidataRepositoryAdapterUnitTest : MockkBaseTest { "Q42", ParsedIRI("https://www.wikidata.org/entity/Q42"), WikidataServiceAdapter::findClassByURI, - wikidataClassSuccessResponseJson, - wikidataResourceSuccessResponseJson, // should fail, because response contains a resource and not a class + responseJson("wikidata/classSuccess"), + responseJson("wikidata/resourceSuccess"), // should fail, because response contains a resource and not a class ExternalThing( uri = ParsedIRI("https://www.wikidata.org/entity/Q42"), label = "Douglas Adams", @@ -291,160 +292,3 @@ internal class WikidataRepositoryAdapterUnitTest : MockkBaseTest { ) } } - -private const val wikidataItemSuccessResponseJson = """{ - "entities": { - "Q42": { - "type": "item", - "id": "Q42", - "labels": { - "en": { - "language": "en", - "value": "Douglas Adams" - } - }, - "descriptions": { - "en": { - "language": "en", - "value": "English author and humourist (1952-2001)" - } - }, - "claims": {} - } - }, - "success": 1 -}""" - -private const val wikidataResourceSuccessResponseJson = """{ - "entities": { - "Q42": { - "type": "item", - "id": "Q42", - "labels": { - "en": { - "language": "en", - "value": "Douglas Adams" - } - }, - "descriptions": { - "en": { - "language": "en", - "value": "English author and humourist (1952-2001)" - } - }, - "claims": { - "P31": [ - { - "mainsnak": { - "snaktype": "value", - "property": "P31", - "hash": "ad7d38a03cdd40cdc373de0dc4e7b7fcbccb31d9", - "datavalue": { - "value": { - "entity-type": "item", - "numeric-id": 5, - "id": "Q5" - }, - "type": "wikibase-entityid" - }, - "datatype": "wikibase-item" - }, - "type": "statement", - "id": "Q42${'$'}F47D50E2-5300-43F3-9243-561D03116FD6", - "rank": "normal" - } - ] - } - } - }, - "success": 1 -}""" - -private const val wikidataClassSuccessResponseJson = """{ - "entities": { - "Q42": { - "type": "item", - "id": "Q42", - "labels": { - "en": { - "language": "en", - "value": "Douglas Adams" - } - }, - "descriptions": { - "en": { - "language": "en", - "value": "English author and humourist (1952-2001)" - } - }, - "claims": { - "P279": [ - { - "mainsnak": { - "snaktype": "value", - "property": "P279", - "hash": "99cd05056004024645944a094b0f764f9aab586f", - "datavalue": { - "value": { - "entity-type": "item", - "numeric-id": 4120621, - "id": "Q4120621" - }, - "type": "wikibase-entityid" - }, - "datatype": "wikibase-item" - }, - "type": "statement", - "id": "Q427626${'$'}49253a61-476c-63c4-a873-4e141dc33260", - "rank": "normal" - } - ] - } - } - }, - "success": 1 -}""" - -private const val wikidataPropertySuccessResponseJson = """{ - "entities": { - "P30": { - "type": "property", - "datatype": "wikibase-item", - "id": "P30", - "labels": { - "en": { - "language": "en", - "value": "continent" - } - }, - "descriptions": { - "en": { - "language": "en", - "value": "continent of which the subject is a part" - } - } - } - }, - "success": 1 -}""" - -private const val wikidataNotFoundResponseJson = """{ - "error": { - "code": "no-such-entity", - "info": "Could not find an entity with the ID \"Q42\".", - "id": "Q42", - "messages": [ - { - "name": "wikibase-api-no-such-entity", - "parameters": [ - "Q42" - ], - "html": { - "*":"Could not find an entity with the ID \"Q42\"." - } - } - ], - "*": "See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/> for notice of API deprecations and breaking changes." - }, - "servedby": "mw-api-ext.eqiad.main-5dff684f6-jrlxv" -}""" diff --git a/graph/graph-adapter-output-web/src/test/resources/assets/responses/geonames/citySuccess.json b/graph/graph-adapter-output-web/src/test/resources/assets/responses/geonames/citySuccess.json new file mode 100644 index 000000000..d7898d019 --- /dev/null +++ b/graph/graph-adapter-output-web/src/test/resources/assets/responses/geonames/citySuccess.json @@ -0,0 +1,59 @@ +{ + "timezone": { + "gmtOffset": 1, + "timeZoneId": "Europe/Berlin", + "dstOffset": 2 + }, + "bbox": { + "east": 13.7604692835498, + "south": 52.3382418348765, + "north": 52.6749171487584, + "west": 13.0883332178678, + "accuracyLevel": 0 + }, + "asciiName": "Berlin", + "astergdem": 52, + "countryId": "2921044", + "fcl": "P", + "srtm3": 43, + "adminId3": "6547383", + "countryCode": "DE", + "adminId4": "6547539", + "adminCodes1": { + "ISO3166_2": "BE" + }, + "adminId1": "2950157", + "lat": "52.52437", + "fcode": "PPLC", + "continentCode": "EU", + "elevation": 74, + "adminCode2": "00", + "adminCode3": "11000", + "adminCode1": "16", + "lng": "13.41053", + "geonameId": 2950159, + "toponymName": "Berlin", + "adminCode4": "11000000", + "population": 3426354, + "wikipediaURL": "en.wikipedia.org/wiki/Berlin", + "adminName5": "", + "adminName4": "Berlin", + "adminName3": "Berlin, Stadt", + "alternateNames": [ + { + "isPreferredName": true, + "name": "Berlin", + "lang": "de" + }, + { + "name": "Berlin", + "lang": "en" + } + ], + "adminName2": "", + "name": "Berlin", + "fclName": "city, village,...", + "countryName": "Germany", + "fcodeName": "capital of a political entity", + "adminName1": "Berlin" +} diff --git a/graph/graph-adapter-output-web/src/test/resources/assets/responses/ols/individualSuccess.json b/graph/graph-adapter-output-web/src/test/resources/assets/responses/ols/individualSuccess.json new file mode 100644 index 000000000..ad965303a --- /dev/null +++ b/graph/graph-adapter-output-web/src/test/resources/assets/responses/ols/individualSuccess.json @@ -0,0 +1,174 @@ +{ + "page": 0, + "numElements": 1, + "totalPages": 1, + "totalElements": 1, + "elements": [ + { + "appearsIn": [ + "abcd" + ], + "curie": "AbsenceObservation", + "definedBy": [ + "abcd" + ], + "definition": [ + "A record describing an output of an observation process with indication of the absence of an observation", + "A record describing an output of an observation process with indication of the absence of an observation" + ], + "definitionProperty": [ + "http://www.w3.org/2000/01/rdf-schema#comment", + "http://www.w3.org/2004/02/skos/core#definition" + ], + "directAncestor": [ + "http://rs.tdwg.org/abcd/terms/RecordBasis" + ], + "directParent": [ + "http://rs.tdwg.org/abcd/terms/RecordBasis" + ], + "hasDirectChildren": false, + "hasDirectParents": true, + "hasHierarchicalChildren": false, + "hasHierarchicalParents": false, + "imported": false, + "iri": "http://rs.tdwg.org/abcd/terms/AbsenceObservation", + "isDefiningOntology": true, + "isObsolete": false, + "label": [ + "AbsenceObservation" + ], + "linkedEntities": { + "http://www.w3.org/2004/02/skos/core#definition": { + "definedBy": [ + "stw", + "skos" + ], + "numAppearsIn": 31, + "hasLocalDefinition": true, + "label": [ + "definition" + ], + "curie": "definition", + "type": [ + "property", + "annotationProperty", + "entity" + ] + }, + "http://www.w3.org/2000/01/rdf-schema#comment": { + "definedBy": [ + "prov" + ], + "numAppearsIn": 53, + "hasLocalDefinition": false, + "label": [ + "comment" + ], + "curie": "comment", + "type": [ + "property", + "annotationProperty", + "entity" + ] + }, + "http://purl.org/dc/terms/modified": { + "definedBy": [ + "dcterms" + ], + "numAppearsIn": 43, + "hasLocalDefinition": true, + "label": [ + "Date Modified" + ], + "curie": "dcterms:/modified", + "type": [ + "dataProperty", + "property", + "entity" + ] + }, + "http://rs.tdwg.org/dwc/terms/attributes/status": { + "numAppearsIn": 2, + "hasLocalDefinition": true, + "label": [ + "status" + ], + "curie": "status", + "type": [ + "property", + "annotationProperty", + "entity" + ] + }, + "http://www.w3.org/2000/01/rdf-schema#isDefinedBy": { + "numAppearsIn": 25, + "hasLocalDefinition": false, + "type": [ + "property", + "annotationProperty", + "entity" + ], + "label": [ + "isDefinedBy" + ], + "curie": "isDefinedBy" + }, + "http://purl.org/dc/terms/issued": { + "definedBy": [ + "dcterms" + ], + "numAppearsIn": 35, + "hasLocalDefinition": true, + "label": [ + "Date Issued" + ], + "curie": "dcterms:/issued", + "type": [ + "dataProperty", + "property", + "entity" + ] + }, + "http://rs.tdwg.org/abcd/terms/RecordBasis": { + "definedBy": [ + "abcd" + ], + "numAppearsIn": 1, + "hasLocalDefinition": true, + "label": [ + "Record Basis" + ], + "curie": "RecordBasis", + "type": [ + "class", + "entity" + ] + } + }, + "numDescendants": 0, + "numHierarchicalDescendants": 0, + "ontologyId": "abcd", + "ontologyIri": "http://rs.tdwg.org/abcd/terms/", + "ontologyPreferredPrefix": "abcd", + "searchableAnnotationValues": [ + false + ], + "shortForm": "AbsenceObservation", + "type": [ + "individual", + "entity" + ], + "http://purl.org/dc/terms/issued": "2019-01-31", + "http://purl.org/dc/terms/modified": "2019-01-31", + "http://rs.tdwg.org/dwc/terms/attributes/status": "recommended", + "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": [ + "http://www.w3.org/2002/07/owl#NamedIndividual", + "http://rs.tdwg.org/abcd/terms/RecordBasis" + ], + "http://www.w3.org/2000/01/rdf-schema#comment": "A record describing an output of an observation process with indication of the absence of an observation", + "http://www.w3.org/2000/01/rdf-schema#isDefinedBy": "http://rs.tdwg.org/abcd/terms/", + "http://www.w3.org/2004/02/skos/core#definition": "A record describing an output of an observation process with indication of the absence of an observation" + } + ], + "facetFieldsToCounts": {} +} diff --git a/graph/graph-adapter-output-web/src/test/resources/assets/responses/ols/propertySuccess.json b/graph/graph-adapter-output-web/src/test/resources/assets/responses/ols/propertySuccess.json new file mode 100644 index 000000000..e6e97bc5a --- /dev/null +++ b/graph/graph-adapter-output-web/src/test/resources/assets/responses/ols/propertySuccess.json @@ -0,0 +1,210 @@ +{ + "page": 0, + "numElements": 1, + "totalPages": 1, + "totalElements": 1, + "elements": [ + { + "appearsIn": [ + "abcd" + ], + "curie": "hasCountry", + "definedBy": [ + "abcd" + ], + "definition": [ + "Property to connect an instance of a class to a Country.", + "Property to connect an instance of a class to a Country." + ], + "definitionProperty": [ + "http://www.w3.org/2000/01/rdf-schema#comment", + "http://www.w3.org/2004/02/skos/core#definition" + ], + "hasDirectChildren": false, + "hasDirectParents": false, + "hasHierarchicalChildren": false, + "hasHierarchicalParents": false, + "imported": false, + "iri": "http://rs.tdwg.org/abcd/terms/hasCountry", + "isDefiningOntology": true, + "isObsolete": false, + "isPreferredRoot": false, + "label": [ + "has Country" + ], + "linkedEntities": { + "http://www.w3.org/2004/02/skos/core#definition": { + "definedBy": [ + "stw", + "skos" + ], + "numAppearsIn": 31, + "hasLocalDefinition": true, + "label": [ + "definition" + ], + "curie": "definition", + "type": [ + "property", + "annotationProperty", + "entity" + ] + }, + "http://rs.tdwg.org/dwc/terms/attributes/status": { + "numAppearsIn": 2, + "hasLocalDefinition": true, + "label": [ + "status" + ], + "curie": "status", + "type": [ + "property", + "annotationProperty", + "entity" + ] + }, + "http://www.w3.org/2000/01/rdf-schema#range": { + "numAppearsIn": 1, + "hasLocalDefinition": false, + "type": [ + "property", + "entity" + ], + "label": [ + "range" + ], + "curie": "range" + }, + "http://www.w3.org/2000/01/rdf-schema#isDefinedBy": { + "numAppearsIn": 25, + "hasLocalDefinition": false, + "type": [ + "property", + "annotationProperty", + "entity" + ], + "label": [ + "isDefinedBy" + ], + "curie": "isDefinedBy" + }, + "http://rs.tdwg.org/abcd/terms/Country": { + "definedBy": [ + "abcd" + ], + "numAppearsIn": 1, + "hasLocalDefinition": true, + "label": [ + "Country" + ], + "curie": "Country", + "type": [ + "class", + "entity" + ] + }, + "http://www.w3.org/2000/01/rdf-schema#comment": { + "definedBy": [ + "prov" + ], + "numAppearsIn": 53, + "hasLocalDefinition": false, + "label": [ + "comment" + ], + "curie": "comment", + "type": [ + "property", + "annotationProperty", + "entity" + ] + }, + "http://purl.org/dc/terms/modified": { + "definedBy": [ + "dcterms" + ], + "numAppearsIn": 43, + "hasLocalDefinition": true, + "label": [ + "Date Modified" + ], + "curie": "dcterms:/modified", + "type": [ + "dataProperty", + "property", + "entity" + ] + }, + "http://www.w3.org/2000/01/rdf-schema#domain": { + "numAppearsIn": 1, + "hasLocalDefinition": false, + "type": [ + "property", + "entity" + ], + "label": [ + "domain" + ], + "curie": "domain" + }, + "http://purl.org/dc/terms/issued": { + "definedBy": [ + "dcterms" + ], + "numAppearsIn": 35, + "hasLocalDefinition": true, + "label": [ + "Date Issued" + ], + "curie": "dcterms:/issued", + "type": [ + "dataProperty", + "property", + "entity" + ] + }, + "http://www.w3.org/2000/01/rdf-schema#label": { + "definedBy": [ + "prov" + ], + "numAppearsIn": 53, + "hasLocalDefinition": false, + "label": [ + "label" + ], + "curie": "label", + "type": [ + "property", + "annotationProperty", + "entity" + ] + } + }, + "numDescendants": 0, + "numHierarchicalDescendants": 0, + "ontologyId": "abcd", + "ontologyIri": "http://rs.tdwg.org/abcd/terms/", + "ontologyPreferredPrefix": "abcd", + "searchableAnnotationValues": [ + false + ], + "shortForm": "hasCountry", + "type": [ + "property", + "objectProperty", + "entity" + ], + "http://purl.org/dc/terms/issued": "2019-01-31", + "http://purl.org/dc/terms/modified": "2019-01-31", + "http://rs.tdwg.org/dwc/terms/attributes/status": "recommended", + "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": "http://www.w3.org/2002/07/owl#ObjectProperty", + "http://www.w3.org/2000/01/rdf-schema#comment": "Property to connect an instance of a class to a Country.", + "http://www.w3.org/2000/01/rdf-schema#domain": "http://www.w3.org/2002/07/owl#Thing", + "http://www.w3.org/2000/01/rdf-schema#isDefinedBy": "http://rs.tdwg.org/abcd/terms/", + "http://www.w3.org/2000/01/rdf-schema#label": "has Country", + "http://www.w3.org/2000/01/rdf-schema#range": "http://rs.tdwg.org/abcd/terms/Country", + "http://www.w3.org/2004/02/skos/core#definition": "Property to connect an instance of a class to a Country." + } + ], + "facetFieldsToCounts": {} +} diff --git a/graph/graph-adapter-output-web/src/test/resources/assets/responses/ols/termSuccess.json b/graph/graph-adapter-output-web/src/test/resources/assets/responses/ols/termSuccess.json new file mode 100644 index 000000000..3ef9b4765 --- /dev/null +++ b/graph/graph-adapter-output-web/src/test/resources/assets/responses/ols/termSuccess.json @@ -0,0 +1,163 @@ +{ + "page": 0, + "numElements": 1, + "totalPages": 1, + "totalElements": 1, + "elements": [ + { + "appearsIn": [ + "cf", + "meth", + "afo", + "skos", + "stw", + "linsearch", + "modsci", + "skosxl" + ], + "curie": "Collection", + "definedBy": [ + "stw", + "skos" + ], + "definition": [ + "A meaningful collection of concepts." + ], + "definitionProperty": "http://www.w3.org/2004/02/skos/core#definition", + "hasDirectChildren": true, + "hasDirectParents": false, + "hasHierarchicalChildren": true, + "hasHierarchicalParents": false, + "imported": false, + "iri": "http://www.w3.org/2004/02/skos/core#Collection", + "isDefiningOntology": true, + "isObsolete": false, + "isPreferredRoot": false, + "label": [ + "Collection" + ], + "linkedEntities": { + "http://www.w3.org/2004/02/skos/core#definition": { + "definedBy": [ + "stw", + "skos" + ], + "numAppearsIn": 31, + "hasLocalDefinition": true, + "label": [ + "definition" + ], + "curie": "definition", + "type": [ + "property", + "annotationProperty", + "entity" + ] + }, + "http://www.w3.org/2004/02/skos/core#Concept": { + "definedBy": [ + "stw", + "skos" + ], + "numAppearsIn": 14, + "hasLocalDefinition": true, + "label": [ + "Concept" + ], + "curie": "Concept", + "type": [ + "class", + "entity" + ] + }, + "http://www.w3.org/2004/02/skos/core#scopeNote": { + "definedBy": [ + "stw", + "skos" + ], + "numAppearsIn": 18, + "hasLocalDefinition": true, + "label": [ + "scope note" + ], + "curie": "scopeNote", + "type": [ + "property", + "annotationProperty", + "entity" + ] + }, + "http://www.w3.org/2000/01/rdf-schema#isDefinedBy": { + "numAppearsIn": 25, + "hasLocalDefinition": false, + "type": [ + "property", + "annotationProperty", + "entity" + ], + "label": [ + "isDefinedBy" + ], + "curie": "isDefinedBy" + }, + "http://www.w3.org/2004/02/skos/core#ConceptScheme": { + "definedBy": [ + "stw", + "skos" + ], + "numAppearsIn": 11, + "hasLocalDefinition": true, + "label": [ + "Concept Scheme" + ], + "curie": "ConceptScheme", + "type": [ + "class", + "entity" + ] + }, + "http://www.w3.org/2000/01/rdf-schema#label": { + "definedBy": [ + "prov" + ], + "numAppearsIn": 53, + "hasLocalDefinition": false, + "label": [ + "label" + ], + "curie": "label", + "type": [ + "property", + "annotationProperty", + "entity" + ] + } + }, + "numDescendants": 1, + "numHierarchicalDescendants": 1, + "ontologyId": "skos", + "ontologyIri": "http://www.w3.org/2004/02/skos/core", + "ontologyPreferredPrefix": "SKOS", + "searchableAnnotationValues": [ + "A meaningful collection of concepts.", + "Labelled collections can be used where you would like a set of concepts to be displayed under a 'node label' in the hierarchy.", + false + ], + "shortForm": "Collection", + "type": [ + "class", + "entity" + ], + "http://www.w3.org/1999/02/22-rdf-syntax-ns#type": "http://www.w3.org/2002/07/owl#Class", + "http://www.w3.org/2000/01/rdf-schema#isDefinedBy": "http://www.w3.org/2004/02/skos/core", + "http://www.w3.org/2000/01/rdf-schema#label": "Collection", + "http://www.w3.org/2002/07/owl#disjointWith": [ + "http://www.w3.org/2004/02/skos/core#Concept", + "http://www.w3.org/2004/02/skos/core#ConceptScheme" + ], + "http://www.w3.org/2004/02/skos/core#definition": "A meaningful collection of concepts.", + "http://www.w3.org/2004/02/skos/core#scopeNote": "Labelled collections can be used where you would like a set of concepts to be displayed under a 'node label' in the hierarchy." + } + ], + "facetFieldsToCounts": {} +} diff --git a/graph/graph-adapter-output-web/src/test/resources/assets/responses/wikidata/classSuccess.json b/graph/graph-adapter-output-web/src/test/resources/assets/responses/wikidata/classSuccess.json new file mode 100644 index 000000000..1fe43500d --- /dev/null +++ b/graph/graph-adapter-output-web/src/test/resources/assets/responses/wikidata/classSuccess.json @@ -0,0 +1,44 @@ +{ + "entities": { + "Q42": { + "type": "item", + "id": "Q42", + "labels": { + "en": { + "language": "en", + "value": "Douglas Adams" + } + }, + "descriptions": { + "en": { + "language": "en", + "value": "English author and humourist (1952-2001)" + } + }, + "claims": { + "P279": [ + { + "mainsnak": { + "snaktype": "value", + "property": "P279", + "hash": "99cd05056004024645944a094b0f764f9aab586f", + "datavalue": { + "value": { + "entity-type": "item", + "numeric-id": 4120621, + "id": "Q4120621" + }, + "type": "wikibase-entityid" + }, + "datatype": "wikibase-item" + }, + "type": "statement", + "id": "Q427626${'$'}49253a61-476c-63c4-a873-4e141dc33260", + "rank": "normal" + } + ] + } + } + }, + "success": 1 +} diff --git a/graph/graph-adapter-output-web/src/test/resources/assets/responses/wikidata/entityNotFound.json b/graph/graph-adapter-output-web/src/test/resources/assets/responses/wikidata/entityNotFound.json new file mode 100644 index 000000000..62a45bf7e --- /dev/null +++ b/graph/graph-adapter-output-web/src/test/resources/assets/responses/wikidata/entityNotFound.json @@ -0,0 +1,20 @@ +{ + "error": { + "code": "no-such-entity", + "info": "Could not find an entity with the ID \"Q42\".", + "id": "Q42", + "messages": [ + { + "name": "wikibase-api-no-such-entity", + "parameters": [ + "Q42" + ], + "html": { + "*":"Could not find an entity with the ID \"Q42\"." + } + } + ], + "*": "See https://www.wikidata.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/postorius/lists/mediawiki-api-announce.lists.wikimedia.org/> for notice of API deprecations and breaking changes." + }, + "servedby": "mw-api-ext.eqiad.main-5dff684f6-jrlxv" +} diff --git a/graph/graph-adapter-output-web/src/test/resources/assets/responses/wikidata/itemSuccess.json b/graph/graph-adapter-output-web/src/test/resources/assets/responses/wikidata/itemSuccess.json new file mode 100644 index 000000000..eb6a0c736 --- /dev/null +++ b/graph/graph-adapter-output-web/src/test/resources/assets/responses/wikidata/itemSuccess.json @@ -0,0 +1,22 @@ +{ + "entities": { + "Q42": { + "type": "item", + "id": "Q42", + "labels": { + "en": { + "language": "en", + "value": "Douglas Adams" + } + }, + "descriptions": { + "en": { + "language": "en", + "value": "English author and humourist (1952-2001)" + } + }, + "claims": {} + } + }, + "success": 1 +} diff --git a/graph/graph-adapter-output-web/src/test/resources/assets/responses/wikidata/propertySuccess.json b/graph/graph-adapter-output-web/src/test/resources/assets/responses/wikidata/propertySuccess.json new file mode 100644 index 000000000..a88c51f76 --- /dev/null +++ b/graph/graph-adapter-output-web/src/test/resources/assets/responses/wikidata/propertySuccess.json @@ -0,0 +1,22 @@ +{ + "entities": { + "P30": { + "type": "property", + "datatype": "wikibase-item", + "id": "P30", + "labels": { + "en": { + "language": "en", + "value": "continent" + } + }, + "descriptions": { + "en": { + "language": "en", + "value": "continent of which the subject is a part" + } + } + } + }, + "success": 1 +} diff --git a/graph/graph-adapter-output-web/src/test/resources/assets/responses/wikidata/resourceSuccess.json b/graph/graph-adapter-output-web/src/test/resources/assets/responses/wikidata/resourceSuccess.json new file mode 100644 index 000000000..0953f17d3 --- /dev/null +++ b/graph/graph-adapter-output-web/src/test/resources/assets/responses/wikidata/resourceSuccess.json @@ -0,0 +1,44 @@ +{ + "entities": { + "Q42": { + "type": "item", + "id": "Q42", + "labels": { + "en": { + "language": "en", + "value": "Douglas Adams" + } + }, + "descriptions": { + "en": { + "language": "en", + "value": "English author and humourist (1952-2001)" + } + }, + "claims": { + "P31": [ + { + "mainsnak": { + "snaktype": "value", + "property": "P31", + "hash": "ad7d38a03cdd40cdc373de0dc4e7b7fcbccb31d9", + "datavalue": { + "value": { + "entity-type": "item", + "numeric-id": 5, + "id": "Q5" + }, + "type": "wikibase-entityid" + }, + "datatype": "wikibase-item" + }, + "type": "statement", + "id": "Q42${'$'}F47D50E2-5300-43F3-9243-561D03116FD6", + "rank": "normal" + } + ] + } + } + }, + "success": 1 +} diff --git a/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/ComparisonControllerIntegrationTest.kt b/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/ComparisonControllerIntegrationTest.kt index cd344a46c..ed4159e55 100644 --- a/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/ComparisonControllerIntegrationTest.kt +++ b/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/ComparisonControllerIntegrationTest.kt @@ -16,6 +16,7 @@ import org.orkg.common.ContributorId import org.orkg.common.ObservatoryId import org.orkg.common.OrganizationId import org.orkg.common.ThingId +import org.orkg.common.testing.fixtures.Assets.requestJson import org.orkg.community.input.ContributorUseCases import org.orkg.community.input.ObservatoryUseCases import org.orkg.community.input.OrganizationUseCases @@ -217,7 +218,7 @@ internal class ComparisonControllerIntegrationTest : MockMvcBaseTest("comparison @TestWithMockUser fun createAndFetchAndUpdate() { val id = post("/api/comparisons") - .content(createComparisonJson) + .content(requestJson("orkg/createComparison")) .accept(COMPARISON_JSON_V2) .contentType(COMPARISON_JSON_V2) .perform() @@ -355,7 +356,7 @@ internal class ComparisonControllerIntegrationTest : MockMvcBaseTest("comparison } put("/api/comparisons/{id}", id) - .content(updateComparisonJson) + .content(requestJson("orkg/updateComparison")) .accept(COMPARISON_JSON_V2) .contentType(COMPARISON_JSON_V2) .perform() @@ -487,229 +488,3 @@ internal class ComparisonControllerIntegrationTest : MockMvcBaseTest("comparison } } } - -private const val createComparisonJson = """{ - "title": "example comparison", - "description": "comparison description", - "research_fields": [ - "R12" - ], - "authors": [ - { - "name": "Author with id", - "id": "R123" - }, - { - "name": "Author with orcid", - "identifiers": { - "orcid": ["0000-1111-2222-3333"] - } - }, - { - "name": "Author with id and orcid", - "id": "R456", - "identifiers": { - "orcid": ["1111-2222-3333-4444"] - } - }, - { - "name": "Author with homepage", - "homepage": "https://example.org/author" - }, - { - "name": "Author that just has a name" - } - ], - "sdgs": ["SDG_1", "SDG_2"], - "contributions": [ - "R6541", "R5364", "R9786", "R3120" - ], - "config": { - "contributions": [ - "R456789", - "R987654" - ], - "predicates": [], - "transpose": false, - "type": "MERGE" - }, - "data": { - "contributions": [ - { - "active": true, - "id": "R456789", - "label": "Contribution 1", - "paper_id": "R456", - "paper_label": "Paper 1", - "paper_year": 2024 - }, - { - "active": true, - "id": "R987654", - "label": "Contribution 1", - "paper_id": "R789", - "paper_label": "Paper 2", - "paper_year": 2022 - } - ], - "data": { - "P32": [ - [ - { - "_class": "resource", - "classes": ["Problem"], - "id": "R192326", - "label": "Covid-19 Pandemic Ontology Development", - "path": [ - "R187004", - "P32" - ], - "path_labels": [ - "Contribution 1", - "research problem" - ] - } - ] - ] - }, - "predicates": [ - { - "active": true, - "id": "P32", - "label": "research problem", - "n_contributions": 2, - "similar_predicates": ["P15"] - } - ] - }, - "references": [ - "https://orkg.org/resources/R1000", - "paper citation" - ], - "observatories": [ - "1afefdd0-5c09-4c9c-b718-2b35316b56f3" - ], - "organizations": [ - "edc18168-c4ee-4cb8-a98a-136f748e912e" - ], - "is_anonymized": false, - "extraction_method": "MANUAL" -}""" - -private const val updateComparisonJson = """{ - "title": "updated comparison", - "description": "updated comparison description", - "research_fields": [ - "R13" - ], - "authors": [ - { - "name": "Other author with id", - "id": "R124" - }, - { - "name": "Author with orcid", - "identifiers": { - "orcid": ["0000-1111-2222-3333"] - } - }, - { - "name": "Author with id and orcid", - "id": "R456", - "identifiers": { - "orcid": ["1111-2222-3333-4444"] - } - }, - { - "name": "Author with homepage", - "homepage": "https://example.org/author" - }, - { - "name": "Author that just has a name" - } - ], - "sdgs": ["SDG_3", "SDG_2"], - "contributions": [ - "R6541", "R5364", "R3120", "R7864" - ], - "config": { - "contributions": [ - "R456790", - "R987654", - "R1546864" - ], - "predicates": [], - "transpose": false, - "type": "PATH" - }, - "data": { - "contributions": [ - { - "active": true, - "id": "R456790", - "label": "Contribution 2", - "paper_id": "R456", - "paper_label": "Paper 1", - "paper_year": 2024 - }, - { - "active": true, - "id": "R987654", - "label": "Contribution 1", - "paper_id": "R789", - "paper_label": "Paper 2", - "paper_year": 2022 - }, - { - "active": true, - "id": "R1546864", - "label": "Contribution 1", - "paper_id": "R258", - "paper_label": "Paper 3", - "paper_year": 2023 - } - ], - "data": { - "P32": [ - [ - { - "_class": "resource", - "classes": ["Problem"], - "id": "R192326", - "label": "Covid-19 Pandemic Ontology Development", - "path": [ - "R187004", - "P32" - ], - "path_labels": [ - "Contribution 1", - "research problem" - ] - } - ] - ] - }, - "predicates": [ - { - "active": true, - "id": "P32", - "label": "research problem", - "n_contributions": 2, - "similar_predicates": ["P15"] - } - ] - }, - "references": [ - "other paper citation", - "paper citation" - ], - "observatories": [ - "33d0776f-59ad-465f-a22c-cd794694edc6" - ], - "organizations": [ - "dc9a860c-1a1b-4977-bd6a-9dc21de46df6" - ], - "is_anonymized": true, - "extraction_method": "AUTOMATIC", - "visibility": "DELETED" -}""" diff --git a/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/LiteratureListControllerIntegrationTest.kt b/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/LiteratureListControllerIntegrationTest.kt index 8ac684cd1..b8bb1846d 100644 --- a/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/LiteratureListControllerIntegrationTest.kt +++ b/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/LiteratureListControllerIntegrationTest.kt @@ -13,6 +13,7 @@ import org.orkg.common.ContributorId import org.orkg.common.ObservatoryId import org.orkg.common.OrganizationId import org.orkg.common.ThingId +import org.orkg.common.testing.fixtures.Assets.requestJson import org.orkg.community.input.ContributorUseCases import org.orkg.community.input.ObservatoryUseCases import org.orkg.community.input.OrganizationUseCases @@ -284,7 +285,7 @@ internal class LiteratureListControllerIntegrationTest : MockMvcBaseTest("litera } put("/api/literature-lists/{id}", id) - .content(updateLiteratureListJson) + .content(requestJson("orkg/updateLiteratureList")) .accept(LITERATURE_LIST_JSON_V1) .contentType(LITERATURE_LIST_JSON_V1) .perform() @@ -381,7 +382,7 @@ internal class LiteratureListControllerIntegrationTest : MockMvcBaseTest("litera val id = createLiteratureList() post("/api/literature-lists/$id/sections") - .content(createTextSectionJson) + .content(requestJson("orkg/createLiteratureListTextSection")) .accept(LITERATURE_LIST_SECTION_JSON_V1) .contentType(LITERATURE_LIST_SECTION_JSON_V1) .perform() @@ -401,7 +402,7 @@ internal class LiteratureListControllerIntegrationTest : MockMvcBaseTest("litera val literatureListSectionId = literatureList.sections.last().id put("/api/literature-lists/{id}/sections/{literatureListSectionId}", id, literatureListSectionId) - .content(updateTextSectionJson) + .content(requestJson("orkg/updateLiteratureListTextSection")) .accept(LITERATURE_LIST_SECTION_JSON_V1) .contentType(LITERATURE_LIST_SECTION_JSON_V1) .perform() @@ -424,7 +425,7 @@ internal class LiteratureListControllerIntegrationTest : MockMvcBaseTest("litera val id = createLiteratureList() post("/api/literature-lists/$id/sections") - .content(createListSectionJson) + .content(requestJson("orkg/createLiteratureListListSection")) .accept(LITERATURE_LIST_SECTION_JSON_V1) .contentType(LITERATURE_LIST_SECTION_JSON_V1) .perform() @@ -455,7 +456,7 @@ internal class LiteratureListControllerIntegrationTest : MockMvcBaseTest("litera val literatureListSectionId = literatureList.sections.last().id put("/api/literature-lists/{id}/sections/{literatureListSectionId}", id, literatureListSectionId) - .content(updateListSectionJson) + .content(requestJson("orkg/updateLiteratureListListSection")) .accept(LITERATURE_LIST_SECTION_JSON_V1) .contentType(LITERATURE_LIST_SECTION_JSON_V1) .perform() @@ -484,7 +485,7 @@ internal class LiteratureListControllerIntegrationTest : MockMvcBaseTest("litera } private fun createLiteratureList() = post("/api/literature-lists") - .content(createLiteratureListJson) + .content(requestJson("orkg/createLiteratureList")) .accept(LITERATURE_LIST_JSON_V1) .contentType(LITERATURE_LIST_JSON_V1) .perform() @@ -496,174 +497,3 @@ internal class LiteratureListControllerIntegrationTest : MockMvcBaseTest("litera .substringAfterLast("/") .let(::ThingId) } - -private const val createLiteratureListJson = """{ - "title": "example literature list", - "research_fields": [ - "R12" - ], - "authors": [ - { - "name": "Author with id", - "id": "R123" - }, - { - "name": "Author with orcid", - "identifiers": { - "orcid": ["0000-1111-2222-3333"] - } - }, - { - "name": "Author with id and orcid", - "id": "R456", - "identifiers": { - "orcid": ["1111-2222-3333-4444"] - } - }, - { - "name": "Author with homepage", - "homepage": "https://example.org/author" - }, - { - "name": "Author that just has a name" - } - ], - "sdgs": ["SDG_1", "SDG_2"], - "observatories": [ - "1afefdd0-5c09-4c9c-b718-2b35316b56f3" - ], - "organizations": [ - "edc18168-c4ee-4cb8-a98a-136f748e912e" - ], - "extraction_method": "MANUAL", - "sections": [ - { - "heading": "this is a heading", - "heading_size": 2, - "text": "text contents of this section" - }, - { - "entries": [ - { - "id": "R3003", - "description": "example description" - }, - { - "id": "R3004", - "description": null - } - ] - } - ] -}""" - -private const val updateLiteratureListJson = """{ - "title": "updated literature list title", - "research_fields": [ - "R194" - ], - "authors": [ - { - "name": "Author with id", - "id": "R123" - }, - { - "name": "Author with orcid", - "identifiers": { - "orcid": ["0000-1111-2222-3333"] - } - }, - { - "name": "Author with id and orcid", - "id": "R456", - "identifiers": { - "orcid": ["4444-3333-2222-1111"] - } - }, - { - "name": "Author with homepage", - "homepage": "https://example.org/author" - }, - { - "name": "Another author that just has a name" - } - ], - "sdgs": ["SDG_3", "SDG_4"], - "observatories": [ - "1afefdd0-5c09-4c9c-b718-2b35316b56f3" - ], - "organizations": [ - "edc18168-c4ee-4cb8-a98a-136f748e912e" - ], - "extraction_method": "UNKNOWN", - "sections": [ - { - "heading": "updated heading", - "heading_size": 3, - "text": "updated text contents" - }, - { - "entries": [ - { - "id": "R3004", - "description": "new description" - }, - { - "id": "R3003", - "description": null - }, - { - "id": "R3005", - "description": "updated example description" - } - ] - } - ], - "visibility": "DELETED" -}""" - -private const val createTextSectionJson = """{ - "heading": "text section heading", - "heading_size": 2, - "text": "text section contents" -}""" - -private const val updateTextSectionJson = """{ - "heading": "updated text section heading", - "heading_size": 3, - "text": "updated text section contents" -}""" - -private const val createListSectionJson = """{ - "entries": [ - { - "id": "R3005", - "description": "example description" - }, - { - "id": "R3004", - "description": null - }, - { - "id": "R3003", - "description": null - } - ] -}""" - -private const val updateListSectionJson = """{ - "entries": [ - { - "id": "R3003", - "description": null - }, - { - "id": "R3004", - "description": "new description" - }, - { - "id": "R3005", - "description": "updated example description" - } - ] -}""" diff --git a/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/PaperControllerIntegrationTest.kt b/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/PaperControllerIntegrationTest.kt index 5bf6ffbf7..11046d1f4 100644 --- a/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/PaperControllerIntegrationTest.kt +++ b/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/PaperControllerIntegrationTest.kt @@ -13,6 +13,7 @@ import org.orkg.common.ContributorId import org.orkg.common.ObservatoryId import org.orkg.common.OrganizationId import org.orkg.common.ThingId +import org.orkg.common.testing.fixtures.Assets.requestJson import org.orkg.community.input.ContributorUseCases import org.orkg.community.input.ObservatoryUseCases import org.orkg.community.input.OrganizationUseCases @@ -193,7 +194,7 @@ internal class PaperControllerIntegrationTest : MockMvcBaseTest("papers") { @TestWithMockUser fun createAndFetchAndUpdate() { val id = post("/api/papers") - .content(createPaperJson) + .content(requestJson("orkg/createPaper")) .accept(PAPER_JSON_V2) .contentType(PAPER_JSON_V2) .perform() @@ -292,7 +293,7 @@ internal class PaperControllerIntegrationTest : MockMvcBaseTest("papers") { } put("/api/papers/{id}", id) - .content(updatePaperJson) + .content(requestJson("orkg/updatePaper")) .accept(PAPER_JSON_V2) .contentType(PAPER_JSON_V2) .perform() @@ -389,7 +390,7 @@ internal class PaperControllerIntegrationTest : MockMvcBaseTest("papers") { ) val id = post("/api/papers/$paperId/contributions") - .content(createContributionJson) + .content(requestJson("orkg/createContribution")) .accept(CONTRIBUTION_JSON_V2) .contentType(CONTRIBUTION_JSON_V2) .perform() @@ -429,231 +430,3 @@ internal class PaperControllerIntegrationTest : MockMvcBaseTest("papers") { } } } - -private const val createPaperJson = """{ - "title": "example paper", - "research_fields": [ - "R12" - ], - "identifiers": { - "doi": ["10.48550/arXiv.2304.05327"] - }, - "publication_info": { - "published_month": 5, - "published_year": 2015, - "published_in": "conference", - "url": "https://www.example.org" - }, - "authors": [ - { - "name": "Author with id", - "id": "R123" - }, - { - "name": "Author with orcid", - "identifiers": { - "orcid": ["0000-1111-2222-3333"] - } - }, - { - "name": "Author with id and orcid", - "id": "R456", - "identifiers": { - "orcid": ["1111-2222-3333-4444"] - } - }, - { - "name": "Author with homepage", - "homepage": "https://example.org/author" - }, - { - "name": "Author that just has a name" - } - ], - "sdgs": ["SDG_1", "SDG_2"], - "mentionings": ["R3003", "R3004"], - "observatories": [ - "1afefdd0-5c09-4c9c-b718-2b35316b56f3" - ], - "organizations": [ - "edc18168-c4ee-4cb8-a98a-136f748e912e" - ], - "contents": { - "resources": { - "#temp1": { - "label": "MOTO", - "classes": ["Result"] - } - }, - "literals": { - "#temp2": { - "label": "0.1", - "data_type": "xsd:decimal" - } - }, - "predicates": { - "#temp3": { - "label": "hasResult", - "description": "has result" - } - }, - "lists": { - "#temp4": { - "label": "list", - "elements": ["#temp1", "C123"] - } - }, - "contributions": [ - { - "label": "Contribution 1", - "classes": ["C123"], - "statements": { - "P32": [ - { - "id": "R3003" - } - ], - "HAS_EVALUATION": [ - { - "id": "#temp1" - }, - { - "id": "R3004", - "statements": { - "#temp3": [ - { - "id": "R3003" - }, - { - "id": "#temp2" - }, - { - "id": "#temp4" - } - ], - "P32": [ - { - "id": "#temp2" - } - ] - } - } - ] - } - } - ] - }, - "extraction_method": "MANUAL" -}""" - -private const val updatePaperJson = """{ - "title": "updated paper title", - "research_fields": [ - "R194" - ], - "identifiers": { - "doi": ["10.48550/arXiv.2304.05328"], - "isbn": ["978-123456789-0"], - "issn": ["1234-5678"] - }, - "publication_info": { - "published_month": 6, - "published_year": 2016, - "published_in": "other conference", - "url": "https://www.conference.org" - }, - "authors": [ - { - "name": "Author with id", - "id": "R123" - }, - { - "name": "Author with orcid", - "identifiers": { - "orcid": ["0000-1111-2222-3333"] - } - }, - { - "name": "Author with id and orcid", - "id": "R456", - "identifiers": { - "orcid": ["4444-3333-2222-1111"] - } - }, - { - "name": "Author with homepage", - "homepage": "https://example.org/author" - }, - { - "name": "Another author that just has a name" - } - ], - "sdgs": ["SDG_3", "SDG_4"], - "mentionings": ["R3004", "R3005"], - "observatories": [ - "1afefdd0-5c09-4c9c-b718-2b35316b56f3" - ], - "organizations": [ - "edc18168-c4ee-4cb8-a98a-136f748e912e" - ], - "visibility": "DELETED", - "verified": false -}""" - -private const val createContributionJson = """{ - "resources": { - "#temp1": { - "label": "MOTO", - "classes": ["Result"] - } - }, - "literals": { - "#temp2": { - "label": "0.1", - "data_type": "xsd:decimal" - } - }, - "predicates": { - "#temp3": { - "label": "hasResult", - "description": "has result" - } - }, - "lists": { - "#temp4": { - "label": "list", - "elements": ["#temp1", "C123"] - } - }, - "contribution": { - "label": "Contribution 1", - "statements": { - "HAS_EVALUATION": [ - { - "id": "#temp1" - }, - { - "id": "R3004", - "statements": { - "#temp3": [ - { - "id": "R3003" - }, - { - "id": "#temp2" - }, - { - "id": "#temp4" - } - ], - "P32": [ - { - "id": "#temp2" - } - ] - } - } - ] - } - } -}""" diff --git a/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/RosettaStoneStatementControllerIntegrationTest.kt b/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/RosettaStoneStatementControllerIntegrationTest.kt index 1cf537658..94d8c98c6 100644 --- a/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/RosettaStoneStatementControllerIntegrationTest.kt +++ b/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/RosettaStoneStatementControllerIntegrationTest.kt @@ -16,6 +16,7 @@ import org.orkg.common.ObservatoryId import org.orkg.common.OrganizationId import org.orkg.common.RealNumber import org.orkg.common.ThingId +import org.orkg.common.testing.fixtures.Assets.requestJson import org.orkg.community.input.ContributorUseCases import org.orkg.community.input.ObservatoryUseCases import org.orkg.community.input.OrganizationUseCases @@ -279,7 +280,7 @@ internal class RosettaStoneStatementControllerIntegrationTest : MockMvcBaseTest( } val updatedId = post("/api/rosetta-stone/statements/{id}", id) - .content(updateRosettaStoneStatementJson) + .content(requestJson("orkg/updateRosettaStoneStatement")) .accept(ROSETTA_STONE_STATEMENT_JSON_V1) .contentType(ROSETTA_STONE_STATEMENT_JSON_V1) .perform() @@ -595,7 +596,7 @@ internal class RosettaStoneStatementControllerIntegrationTest : MockMvcBaseTest( private fun createRosettaStoneStatement(templateId: ThingId): ThingId = post("/api/rosetta-stone/statements") - .content(createRosettaStoneStatementJson.replace("\$templateId", templateId.value)) + .content(requestJson("orkg/createRosettaStoneStatement").replace("\$templateId", templateId.value)) .accept(ROSETTA_STONE_STATEMENT_JSON_V1) .contentType(ROSETTA_STONE_STATEMENT_JSON_V1) .perform() @@ -607,121 +608,3 @@ internal class RosettaStoneStatementControllerIntegrationTest : MockMvcBaseTest( .substringAfterLast("/") .let(::ThingId) } - -private const val createRosettaStoneStatementJson = """{ - "template_id": "${'$'}templateId", - "context": "R789", - "subjects": ["R258", "R369", "#temp1"], - "objects": [ - ["R174", "#temp2", "#temp3"], - ["L123", "#temp4"], - ["L456", "#temp5"], - ["L789", "#temp6"], - ["R258", "R369", "#temp7"] - ], - "certainty": "HIGH", - "negated": false, - "resources": { - "#temp1": { - "label": "Subject Resource", - "classes": ["C28"] - } - }, - "predicates": { - "#temp2": { - "label": "hasResult", - "description": "has result" - } - }, - "classes": { - "#temp3": { - "label": "new class", - "uri": null - } - }, - "literals": { - "#temp4": { - "label": "0123456789", - "data_type": "xsd:string" - }, - "#temp5": { - "label": "1", - "data_type": "xsd:integer" - }, - "#temp6": { - "label": "some literal value", - "data_type": "http://orkg.org/orkg/class/C25" - } - }, - "lists": { - "#temp7": { - "label": "list", - "elements": ["#temp1", "C123"] - } - }, - "observatories": [ - "1afefdd0-5c09-4c9c-b718-2b35316b56f3" - ], - "organizations": [ - "edc18168-c4ee-4cb8-a98a-136f748e912e" - ], - "extraction_method": "MANUAL" -}""" - -private const val updateRosettaStoneStatementJson = """{ - "subjects": ["R369", "R258", "#temp1"], - "objects": [ - ["#temp2", "R174", "#temp3"], - ["#temp4", "L123"], - ["#temp5", "L456"], - ["#temp6", "L789"], - ["R369", "R258", "#temp7"] - ], - "certainty": "MODERATE", - "negated": false, - "resources": { - "#temp1": { - "label": "Updated Subject Resource", - "classes": ["C28"] - } - }, - "predicates": { - "#temp2": { - "label": "hasResult", - "description": "has result too" - } - }, - "classes": { - "#temp3": { - "label": "updated new class", - "uri": null - } - }, - "literals": { - "#temp4": { - "label": "9876543210", - "data_type": "xsd:string" - }, - "#temp5": { - "label": "4", - "data_type": "xsd:integer" - }, - "#temp6": { - "label": "some updated literal value", - "data_type": "http://orkg.org/orkg/class/C25" - } - }, - "lists": { - "#temp7": { - "label": "list", - "elements": ["C123", "#temp1"] - } - }, - "observatories": [ - "1afefdd0-5c09-4c9c-b718-2b35316b56f3" - ], - "organizations": [ - "edc18168-c4ee-4cb8-a98a-136f748e912e" - ], - "extraction_method": "AUTOMATIC" -}""" diff --git a/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/RosettaStoneTemplateControllerIntegrationTest.kt b/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/RosettaStoneTemplateControllerIntegrationTest.kt index 83de1dc02..b66497442 100644 --- a/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/RosettaStoneTemplateControllerIntegrationTest.kt +++ b/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/RosettaStoneTemplateControllerIntegrationTest.kt @@ -14,6 +14,7 @@ import org.orkg.common.ObservatoryId import org.orkg.common.OrganizationId import org.orkg.common.RealNumber import org.orkg.common.ThingId +import org.orkg.common.testing.fixtures.Assets.requestJson import org.orkg.community.input.ContributorUseCases import org.orkg.community.input.ObservatoryUseCases import org.orkg.community.input.OrganizationUseCases @@ -282,7 +283,7 @@ internal class RosettaStoneTemplateControllerIntegrationTest : MockMvcBaseTest(" } put("/api/rosetta-stone/templates/{id}", id) - .content(updateRosettaStoneTemplateJson) + .content(requestJson("orkg/updateRosettaStoneTemplate")) .accept(ROSETTA_STONE_TEMPLATE_JSON_V1) .contentType(ROSETTA_STONE_TEMPLATE_JSON_V1) .perform() @@ -391,7 +392,7 @@ internal class RosettaStoneTemplateControllerIntegrationTest : MockMvcBaseTest(" private fun createRosettaStoneTemplate(): ThingId = post("/api/rosetta-stone/templates") - .content(createRosettaStoneTemplateJson) + .content(requestJson("orkg/createRosettaStoneTemplate")) .accept(ROSETTA_STONE_TEMPLATE_JSON_V1) .contentType(ROSETTA_STONE_TEMPLATE_JSON_V1) .perform() @@ -403,145 +404,3 @@ internal class RosettaStoneTemplateControllerIntegrationTest : MockMvcBaseTest(" .substringAfterLast("/") .let(::ThingId) } - -private const val createRosettaStoneTemplateJson = """{ - "label": "rosetta stone template", - "description": "rosetta stone template description", - "formatted_label": "{0} {1} {2} {3} {4} {5}", - "example_usage": "example statement usage", - "properties": [ - { - "label": "subject position", - "placeholder": "subject", - "description": "subject", - "min_count": 1, - "max_count": 4, - "path": "hasSubjectPosition", - "class": "C28" - }, - { - "label": "property label", - "placeholder": "property placeholder", - "description": "property description", - "min_count": 1, - "max_count": 2, - "path": "hasObjectPosition" - }, - { - "label": "string literal property label", - "placeholder": "string literal property placeholder", - "description": "string literal property description", - "min_count": 1, - "max_count": 2, - "pattern": "\\d+", - "path": "hasObjectPosition", - "datatype": "String" - }, - { - "label": "number literal property label", - "placeholder": "number literal property placeholder", - "description": "number literal property description", - "min_count": 1, - "max_count": 2, - "min_inclusive": -1, - "max_inclusive": 10, - "path": "hasObjectPosition", - "datatype": "Integer" - }, - { - "label": "literal property label", - "placeholder": "literal property placeholder", - "description": "literal property description", - "min_count": 1, - "max_count": 2, - "path": "hasObjectPosition", - "datatype": "C25" - }, - { - "label": "resource property label", - "placeholder": "resource property placeholder", - "description": "resource property description", - "min_count": 3, - "max_count": 4, - "path": "hasObjectPosition", - "class": "C28" - } - ], - "observatories": [ - "1afefdd0-5c09-4c9c-b718-2b35316b56f3" - ], - "organizations": [ - "edc18168-c4ee-4cb8-a98a-136f748e912e" - ] -}""" - -private const val updateRosettaStoneTemplateJson = """{ - "label": "updated rosetta stone template", - "description": "updated rosetta stone template description", - "formatted_label": "updated {0} {1} {2} {3} {4} {5}", - "example_usage": "updated example statement usage", - "properties": [ - { - "label": "updated subject position", - "placeholder": "updated subject", - "description": "updated subject", - "min_count": 2, - "max_count": 5, - "path": "hasSubjectPosition", - "class": "C28" - }, - { - "label": "updated property label", - "placeholder": "updated property placeholder", - "description": "updated property description", - "min_count": 2, - "max_count": 3, - "path": "hasObjectPosition" - }, - { - "label": "updated string literal property label", - "placeholder": "updated string literal property placeholder", - "description": "updated string literal property description", - "min_count": 2, - "max_count": 3, - "pattern": "\\w+", - "path": "hasObjectPosition", - "datatype": "String" - }, - { - "label": "updated number literal property label", - "placeholder": "updated number literal property placeholder", - "description": "updated number literal property description", - "min_count": 2, - "max_count": 3, - "min_inclusive": 0, - "max_inclusive": 11, - "path": "hasObjectPosition", - "datatype": "Integer" - }, - { - "label": "updated literal property label", - "placeholder": "updated literal property placeholder", - "description": "updated literal property description", - "min_count": 2, - "max_count": 3, - "path": "hasObjectPosition", - "datatype": "C25" - }, - { - "label": "updated resource property label", - "placeholder": "updated resource property placeholder", - "description": "updated resource property description", - "min_count": 4, - "max_count": 5, - "path": "hasObjectPosition", - "class": "C28" - } - ], - "observatories": [ - "1afefdd0-5c09-4c9c-b718-2b35316b56f3" - ], - "organizations": [ - "edc18168-c4ee-4cb8-a98a-136f748e912e" - ] -}""" diff --git a/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/SmartReviewControllerIntegrationTest.kt b/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/SmartReviewControllerIntegrationTest.kt index 3b4dabc61..0020b3d55 100644 --- a/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/SmartReviewControllerIntegrationTest.kt +++ b/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/SmartReviewControllerIntegrationTest.kt @@ -13,6 +13,7 @@ import org.orkg.common.ContributorId import org.orkg.common.ObservatoryId import org.orkg.common.OrganizationId import org.orkg.common.ThingId +import org.orkg.common.testing.fixtures.Assets.requestJson import org.orkg.community.input.ContributorUseCases import org.orkg.community.input.ObservatoryUseCases import org.orkg.community.input.OrganizationUseCases @@ -324,7 +325,7 @@ internal class SmartReviewControllerIntegrationTest : MockMvcBaseTest("smart-rev } put("/api/smart-reviews/{id}", id) - .content(updateSmartReviewJson) + .content(requestJson("orkg/updateSmartReview")) .accept(SMART_REVIEW_JSON_V1) .contentType(SMART_REVIEW_JSON_V1) .perform() @@ -438,7 +439,7 @@ internal class SmartReviewControllerIntegrationTest : MockMvcBaseTest("smart-rev val id = createSmartReview() post("/api/smart-reviews/$id/sections") - .content(createComparisonSectionJson) + .content(requestJson("orkg/createSmartReviewComparisonSection")) .accept(SMART_REVIEW_SECTION_JSON_V1) .contentType(SMART_REVIEW_SECTION_JSON_V1) .perform() @@ -457,7 +458,7 @@ internal class SmartReviewControllerIntegrationTest : MockMvcBaseTest("smart-rev val sectionId = smartReview.sections.last().id put("/api/smart-reviews/{id}/sections/{sectionId}", id, sectionId) - .content(updateComparisonSectionJson) + .content(requestJson("orkg/updateSmartReviewComparisonSection")) .accept(SMART_REVIEW_SECTION_JSON_V1) .contentType(SMART_REVIEW_SECTION_JSON_V1) .perform() @@ -479,7 +480,7 @@ internal class SmartReviewControllerIntegrationTest : MockMvcBaseTest("smart-rev val smartReviewId = createSmartReview() post("/api/smart-reviews/$smartReviewId/sections") - .content(createVisualizationSectionJson) + .content(requestJson("orkg/createSmartReviewVisualizationSection")) .accept(SMART_REVIEW_SECTION_JSON_V1) .contentType(SMART_REVIEW_SECTION_JSON_V1) .perform() @@ -498,7 +499,7 @@ internal class SmartReviewControllerIntegrationTest : MockMvcBaseTest("smart-rev val sectionId = smartReview.sections.last().id put("/api/smart-reviews/{id}/sections/{sectionId}", smartReviewId, sectionId) - .content(updateVisualizationSectionJson) + .content(requestJson("orkg/updateSmartReviewVisualizationSection")) .accept(SMART_REVIEW_SECTION_JSON_V1) .contentType(SMART_REVIEW_SECTION_JSON_V1) .perform() @@ -520,7 +521,7 @@ internal class SmartReviewControllerIntegrationTest : MockMvcBaseTest("smart-rev val id = createSmartReview() post("/api/smart-reviews/$id/sections") - .content(createResourceSectionJson) + .content(requestJson("orkg/createSmartReviewResourceSection")) .accept(SMART_REVIEW_SECTION_JSON_V1) .contentType(SMART_REVIEW_SECTION_JSON_V1) .perform() @@ -539,7 +540,7 @@ internal class SmartReviewControllerIntegrationTest : MockMvcBaseTest("smart-rev val sectionId = smartReview.sections.last().id put("/api/smart-reviews/{id}/sections/{sectionId}", id, sectionId) - .content(updateResourceSectionJson) + .content(requestJson("orkg/updateSmartReviewResourceSection")) .accept(SMART_REVIEW_SECTION_JSON_V1) .contentType(SMART_REVIEW_SECTION_JSON_V1) .perform() @@ -561,7 +562,7 @@ internal class SmartReviewControllerIntegrationTest : MockMvcBaseTest("smart-rev val id = createSmartReview() post("/api/smart-reviews/$id/sections") - .content(createPredicateSectionJson) + .content(requestJson("orkg/createSmartReviewPredicateSection")) .accept(SMART_REVIEW_SECTION_JSON_V1) .contentType(SMART_REVIEW_SECTION_JSON_V1) .perform() @@ -580,7 +581,7 @@ internal class SmartReviewControllerIntegrationTest : MockMvcBaseTest("smart-rev val sectionId = smartReview.sections.last().id put("/api/smart-reviews/{id}/sections/{sectionId}", id, sectionId) - .content(updatePredicateSectionJson) + .content(requestJson("orkg/updateSmartReviewPredicateSection")) .accept(SMART_REVIEW_SECTION_JSON_V1) .contentType(SMART_REVIEW_SECTION_JSON_V1) .perform() @@ -602,7 +603,7 @@ internal class SmartReviewControllerIntegrationTest : MockMvcBaseTest("smart-rev val id = createSmartReview() post("/api/smart-reviews/$id/sections") - .content(createOntologySectionJson) + .content(requestJson("orkg/createSmartReviewOntologySection")) .accept(SMART_REVIEW_SECTION_JSON_V1) .contentType(SMART_REVIEW_SECTION_JSON_V1) .perform() @@ -625,7 +626,7 @@ internal class SmartReviewControllerIntegrationTest : MockMvcBaseTest("smart-rev val sectionId = smartReview.sections.last().id put("/api/smart-reviews/{id}/sections/{sectionId}", id, sectionId) - .content(updateOntologySectionJson) + .content(requestJson("orkg/updateSmartReviewOntologySection")) .accept(SMART_REVIEW_SECTION_JSON_V1) .contentType(SMART_REVIEW_SECTION_JSON_V1) .perform() @@ -651,7 +652,7 @@ internal class SmartReviewControllerIntegrationTest : MockMvcBaseTest("smart-rev val id = createSmartReview() post("/api/smart-reviews/$id/sections") - .content(createTextSectionJson) + .content(requestJson("orkg/createSmartReviewTextSection")) .accept(SMART_REVIEW_SECTION_JSON_V1) .contentType(SMART_REVIEW_SECTION_JSON_V1) .perform() @@ -671,7 +672,7 @@ internal class SmartReviewControllerIntegrationTest : MockMvcBaseTest("smart-rev val sectionId = smartReview.sections.last().id put("/api/smart-reviews/{id}/sections/{sectionId}", id, sectionId) - .content(updateTextSectionJson) + .content(requestJson("orkg/updateSmartReviewTextSection")) .accept(SMART_REVIEW_SECTION_JSON_V1) .contentType(SMART_REVIEW_SECTION_JSON_V1) .perform() @@ -689,7 +690,7 @@ internal class SmartReviewControllerIntegrationTest : MockMvcBaseTest("smart-rev } private fun createSmartReview() = post("/api/smart-reviews") - .content(createSmartReviewJson) + .content(requestJson("orkg/createSmartReview")) .accept(SMART_REVIEW_JSON_V1) .contentType(SMART_REVIEW_JSON_V1) .perform() @@ -701,214 +702,3 @@ internal class SmartReviewControllerIntegrationTest : MockMvcBaseTest("smart-rev .substringAfterLast("/") .let(::ThingId) } - -private const val createSmartReviewJson = """{ - "title": "example smart review", - "research_fields": [ - "R12" - ], - "authors": [ - { - "name": "Author with id", - "id": "R123" - }, - { - "name": "Author with orcid", - "identifiers": { - "orcid": ["0000-1111-2222-3333"] - } - }, - { - "name": "Author with id and orcid", - "id": "R456", - "identifiers": { - "orcid": ["1111-2222-3333-4444"] - } - }, - { - "name": "Author with homepage", - "homepage": "https://example.org/author" - }, - { - "name": "Author that just has a name" - } - ], - "sdgs": ["SDG_1", "SDG_2"], - "observatories": [ - "1afefdd0-5c09-4c9c-b718-2b35316b56f3" - ], - "organizations": [ - "edc18168-c4ee-4cb8-a98a-136f748e912e" - ], - "extraction_method": "MANUAL", - "sections": [ - { - "heading": "comparison section heading", - "comparison": "R6416" - }, - { - "heading": "visualization section heading", - "visualization": "R215648" - }, - { - "heading": "resource section heading", - "resource": "R14565" - }, - { - "heading": "predicate section heading", - "predicate": "R15696541" - }, - { - "heading": "ontology section heading", - "entities": ["R1", "P1"], - "predicates": ["P1"] - }, - { - "heading": "Heading", - "class": "Introduction", - "text": "text section contents" - } - ], - "references": [ - "@misc{R615465, title = {reference 1}}", - "@misc{R154146, title = {reference 2}}" - ] -}""" - -private const val updateSmartReviewJson = """{ - "title": "updated smart review title", - "research_fields": [ - "R194" - ], - "authors": [ - { - "name": "Author with id", - "id": "R123" - }, - { - "name": "Author with orcid", - "identifiers": { - "orcid": ["0000-1111-2222-3333"] - } - }, - { - "name": "Author with id and orcid", - "id": "R456", - "identifiers": { - "orcid": ["4444-3333-2222-1111"] - } - }, - { - "name": "Author with homepage", - "homepage": "https://example.org/author" - }, - { - "name": "Another author that just has a name" - } - ], - "sdgs": ["SDG_3", "SDG_4"], - "observatories": [ - "1afefdd0-5c09-4c9c-b718-2b35316b56f3" - ], - "organizations": [ - "edc18168-c4ee-4cb8-a98a-136f748e912e" - ], - "extraction_method": "UNKNOWN", - "sections": [ - { - "heading": "updated comparison section heading", - "comparison": "R26416" - }, - { - "heading": "updated visualization section heading", - "visualization": "R2215648" - }, - { - "heading": "updated resource section heading", - "resource": "R214565" - }, - { - "heading": "updated predicate section heading", - "predicate": "R215696541" - }, - { - "heading": "updated ontology section heading", - "entities": ["R21", "P1"], - "predicates": ["P21"] - }, - { - "heading": "updated text section heading", - "class": "Introduction", - "text": "Introduction text section contents" - } - ], - "references": [ - "@misc{R615465, title = {updated reference 1}}", - "@misc{R154146, title = {updated reference 2}}" - ], - "visibility": "DELETED" -}""" - -private const val createComparisonSectionJson = """{ - "heading": "new comparison section heading", - "comparison": "R6416" -}""" - -private const val createVisualizationSectionJson = """{ - "heading": "new visualization section heading", - "visualization": "R215648" -}""" - -private const val createResourceSectionJson = """{ - "heading": "new resource section heading", - "resource": "R14565" -}""" - -private const val createPredicateSectionJson = """{ - "heading": "new predicate section heading", - "predicate": "R15696541" -}""" - -private const val createOntologySectionJson = """{ - "heading": "new ontology section heading", - "entities": ["R1", "P1"], - "predicates": ["P1"] -}""" - -private const val createTextSectionJson = """{ - "heading": "new text section heading", - "class": "Epilogue", - "text": "Epilogue text section contents" -}""" - -private const val updateComparisonSectionJson = """{ - "heading": "updated comparison section heading", - "comparison": "R26416" -}""" - -private const val updateVisualizationSectionJson = """{ - "heading": "updated visualization section heading", - "visualization": "R2215648" -}""" - -private const val updateResourceSectionJson = """{ - "heading": "updated resource section heading", - "resource": "R214565" -}""" - -private const val updatePredicateSectionJson = """{ - "heading": "updated predicate section heading", - "predicate": "R215696541" -}""" - -private const val updateOntologySectionJson = """{ - "heading": "updated ontology section heading", - "entities": ["R21", "P1"], - "predicates": ["P21"] -}""" - -private const val updateTextSectionJson = """{ - "heading": "updated text section heading", - "class": "Introduction", - "text": "Introduction text section contents" -}""" diff --git a/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/TemplateControllerIntegrationTest.kt b/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/TemplateControllerIntegrationTest.kt index ce239d221..87a6a849e 100644 --- a/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/TemplateControllerIntegrationTest.kt +++ b/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/TemplateControllerIntegrationTest.kt @@ -14,6 +14,7 @@ import org.orkg.common.ObservatoryId import org.orkg.common.OrganizationId import org.orkg.common.RealNumber import org.orkg.common.ThingId +import org.orkg.common.testing.fixtures.Assets.requestJson import org.orkg.community.input.ContributorUseCases import org.orkg.community.input.ObservatoryUseCases import org.orkg.community.input.OrganizationUseCases @@ -177,7 +178,7 @@ internal class TemplateControllerIntegrationTest : MockMvcBaseTest("templates") val id = createTemplate() val template = get("/api/templates/{id}", id) - .content(createTemplateJson) + .content(requestJson("orkg/createTemplate")) .accept(TEMPLATE_JSON_V1) .contentType(TEMPLATE_JSON_V1) .perform() @@ -278,7 +279,7 @@ internal class TemplateControllerIntegrationTest : MockMvcBaseTest("templates") } put("/api/templates/{id}", id) - .content(updateTemplateJson) + .content(requestJson("orkg/updateTemplate")) .accept(TEMPLATE_JSON_V1) .contentType(TEMPLATE_JSON_V1) .perform() @@ -382,7 +383,7 @@ internal class TemplateControllerIntegrationTest : MockMvcBaseTest("templates") val id = createTemplate() post("/api/templates/$id/properties") - .content(createUntypedTemplatePropertyJson) + .content(requestJson("orkg/createUntypedTemplateProperty")) .accept(TEMPLATE_PROPERTY_JSON_V1) .contentType(TEMPLATE_PROPERTY_JSON_V1) .perform() @@ -407,7 +408,7 @@ internal class TemplateControllerIntegrationTest : MockMvcBaseTest("templates") val propertyId = template.properties.first().id put("/api/templates/{id}/properties/{propertyId}", id, propertyId) - .content(updateUntypedTemplatePropertyJson) + .content(requestJson("orkg/updateUntypedTemplateProperty")) .accept(TEMPLATE_PROPERTY_JSON_V1) .contentType(TEMPLATE_PROPERTY_JSON_V1) .perform() @@ -436,7 +437,7 @@ internal class TemplateControllerIntegrationTest : MockMvcBaseTest("templates") val id = createTemplate() post("/api/templates/$id/properties") - .content(createStringLiteralTemplatePropertyJson) + .content(requestJson("orkg/createStringLiteralTemplateProperty")) .accept(TEMPLATE_PROPERTY_JSON_V1) .contentType(TEMPLATE_PROPERTY_JSON_V1) .perform() @@ -463,7 +464,7 @@ internal class TemplateControllerIntegrationTest : MockMvcBaseTest("templates") val propertyId = template.properties.first().id put("/api/templates/{id}/properties/{propertyId}", id, propertyId) - .content(updateStringLiteralTemplatePropertyJson) + .content(requestJson("orkg/updateStringLiteralTemplateProperty")) .accept(TEMPLATE_PROPERTY_JSON_V1) .contentType(TEMPLATE_PROPERTY_JSON_V1) .perform() @@ -494,7 +495,7 @@ internal class TemplateControllerIntegrationTest : MockMvcBaseTest("templates") val id = createTemplate() post("/api/templates/$id/properties") - .content(createNumberLiteralTemplatePropertyJson) + .content(requestJson("orkg/createNumberLiteralTemplateProperty")) .accept(TEMPLATE_PROPERTY_JSON_V1) .contentType(TEMPLATE_PROPERTY_JSON_V1) .perform() @@ -522,7 +523,7 @@ internal class TemplateControllerIntegrationTest : MockMvcBaseTest("templates") val propertyId = template.properties.first().id put("/api/templates/{id}/properties/{propertyId}", id, propertyId) - .content(updateNumberLiteralTemplatePropertyJson) + .content(requestJson("orkg/updateNumberLiteralTemplateProperty")) .accept(TEMPLATE_PROPERTY_JSON_V1) .contentType(TEMPLATE_PROPERTY_JSON_V1) .perform() @@ -554,7 +555,7 @@ internal class TemplateControllerIntegrationTest : MockMvcBaseTest("templates") val id = createTemplate() post("/api/templates/$id/properties") - .content(createOtherLiteralTemplatePropertyJson) + .content(requestJson("orkg/createOtherLiteralTemplateProperty")) .accept(TEMPLATE_PROPERTY_JSON_V1) .contentType(TEMPLATE_PROPERTY_JSON_V1) .perform() @@ -580,7 +581,7 @@ internal class TemplateControllerIntegrationTest : MockMvcBaseTest("templates") val propertyId = template.properties.first().id put("/api/templates/{id}/properties/{propertyId}", id, propertyId) - .content(updateOtherLiteralTemplatePropertyJson) + .content(requestJson("orkg/updateOtherLiteralTemplateProperty")) .accept(TEMPLATE_PROPERTY_JSON_V1) .contentType(TEMPLATE_PROPERTY_JSON_V1) .perform() @@ -610,7 +611,7 @@ internal class TemplateControllerIntegrationTest : MockMvcBaseTest("templates") val id = createTemplate() post("/api/templates/$id/properties") - .content(createResourceTemplatePropertyJson) + .content(requestJson("orkg/createResourceTemplateProperty")) .accept(TEMPLATE_PROPERTY_JSON_V1) .contentType(TEMPLATE_PROPERTY_JSON_V1) .perform() @@ -636,7 +637,7 @@ internal class TemplateControllerIntegrationTest : MockMvcBaseTest("templates") val propertyId = template.properties.first().id put("/api/templates/{id}/properties/{propertyId}", id, propertyId) - .content(updateResourceTemplatePropertyJson) + .content(requestJson("orkg/updateResourceTemplateProperty")) .accept(TEMPLATE_PROPERTY_JSON_V1) .contentType(TEMPLATE_PROPERTY_JSON_V1) .perform() @@ -662,7 +663,7 @@ internal class TemplateControllerIntegrationTest : MockMvcBaseTest("templates") private fun createTemplate(): ThingId = post("/api/templates") - .content(createTemplateJson) + .content(requestJson("orkg/createTemplate")) .accept(TEMPLATE_JSON_V1) .contentType(TEMPLATE_JSON_V1) .perform() @@ -674,246 +675,3 @@ internal class TemplateControllerIntegrationTest : MockMvcBaseTest("templates") .substringAfterLast("/") .let(::ThingId) } - -private const val createTemplateJson = """{ - "label": "example template", - "description": "template description", - "formatted_label": "{P32}", - "target_class": "C123", - "relations": { - "research_fields": ["R12"], - "research_problems": ["R15"], - "predicate": "P32" - }, - "properties": [ - { - "label": "property label", - "placeholder": "property placeholder", - "description": "property description", - "min_count": 1, - "max_count": 2, - "path": "P24" - }, - { - "label": "string literal property label", - "placeholder": "string literal property placeholder", - "description": "string literal property description", - "min_count": 1, - "max_count": 2, - "pattern": "\\d+", - "path": "P24", - "datatype": "String" - }, - { - "label": "number literal property label", - "placeholder": "number literal property placeholder", - "description": "number literal property description", - "min_count": 1, - "max_count": 2, - "min_inclusive": -1, - "max_inclusive": 10, - "path": "P24", - "datatype": "Integer" - }, - { - "label": "literal property label", - "placeholder": "literal property placeholder", - "description": "literal property description", - "min_count": 1, - "max_count": 2, - "path": "P24", - "datatype": "C25" - }, - { - "label": "resource property label", - "placeholder": "resource property placeholder", - "description": "resource property description", - "min_count": 3, - "max_count": 4, - "path": "P27", - "class": "C28" - } - ], - "is_closed": false, - "observatories": [ - "1afefdd0-5c09-4c9c-b718-2b35316b56f3" - ], - "organizations": [ - "edc18168-c4ee-4cb8-a98a-136f748e912e" - ], - "extraction_method": "AUTOMATIC" -}""" - -private const val updateTemplateJson = """{ - "label": "updated example template", - "description": "updated template description", - "formatted_label": "{P34}", - "target_class": "C456", - "relations": { - "research_fields": ["R13"], - "research_problems": ["R16"], - "predicate": "P31" - }, - "properties": [ - { - "label": "updated property label", - "placeholder": null, - "description": null, - "min_count": 4, - "max_count": 7, - "path": "P24" - }, - { - "label": "updated resource property label", - "placeholder": "updated resource property placeholder", - "description": "updated resource property description", - "min_count": 3, - "max_count": 4, - "path": "P27", - "class": "C28" - }, - { - "label": "updated string literal property label", - "placeholder": "updated string literal property placeholder", - "description": "updated string literal property description", - "min_count": 1, - "max_count": 2, - "pattern": "\\w+", - "path": "P24", - "datatype": "String" - }, - { - "label": "updated literal property label", - "placeholder": "updated literal property placeholder", - "description": "updated literal property description", - "min_count": 1, - "max_count": 2, - "path": "P24", - "datatype": "C25" - }, - { - "label": "updated number literal property label", - "placeholder": "updated number literal property placeholder", - "description": "updated number literal property description", - "min_count": 1, - "max_count": 2, - "min_inclusive": -5, - "max_inclusive": 15.5, - "path": "P24", - "datatype": "Decimal" - } - ], - "is_closed": false, - "observatories": [ - "1afefdd0-5c09-4c9c-b718-2b35316b56f3" - ], - "organizations": [ - "edc18168-c4ee-4cb8-a98a-136f748e912e" - ], - "extraction_method": "MANUAL", - "visibility": "DELETED" -}""" - -private const val createUntypedTemplatePropertyJson = """{ - "label": "property label", - "placeholder": "property placeholder", - "description": "property description", - "min_count": 1, - "max_count": 2, - "path": "P24" -}""" - -private const val createStringLiteralTemplatePropertyJson = """{ - "label": "string literal property label", - "placeholder": "string literal property placeholder", - "description": "string literal property description", - "min_count": 1, - "max_count": 2, - "pattern": "\\d+", - "path": "P24", - "datatype": "String" -}""" - -private const val createNumberLiteralTemplatePropertyJson = """{ - "label": "number literal property label", - "placeholder": "number literal property placeholder", - "description": "number literal property description", - "min_count": 1, - "max_count": 2, - "min_inclusive": -1, - "max_inclusive": 10, - "path": "P24", - "datatype": "Integer" -}""" - -private const val createOtherLiteralTemplatePropertyJson = """{ - "label": "literal property label", - "placeholder": "literal property placeholder", - "description": "literal property description", - "min_count": 1, - "max_count": 2, - "path": "P24", - "datatype": "C25" -}""" - -private const val createResourceTemplatePropertyJson = """{ - "label": "resource property label", - "placeholder": "resource property placeholder", - "description": "resource property description", - "min_count": 3, - "max_count": 4, - "path": "P27", - "class": "C28" -}""" - -private const val updateUntypedTemplatePropertyJson = """{ - "label": "updated property label", - "placeholder": null, - "description": null, - "min_count": 4, - "max_count": 7, - "path": "P24" -}""" - -private const val updateStringLiteralTemplatePropertyJson = """{ - "label": "updated string literal property label", - "placeholder": "updated string literal property placeholder", - "description": "updated string literal property description", - "min_count": 1, - "max_count": 2, - "pattern": "\\w+", - "path": "P24", - "datatype": "String" -}""" - -private const val updateNumberLiteralTemplatePropertyJson = """{ - "label": "updated number literal property label", - "placeholder": "updated number literal property placeholder", - "description": "updated number literal property description", - "min_count": 1, - "max_count": 2, - "min_inclusive": -5, - "max_inclusive": 15.5, - "path": "P24", - "datatype": "Decimal" -}""" - -private const val updateOtherLiteralTemplatePropertyJson = """{ - "label": "updated literal property label", - "placeholder": "updated literal property placeholder", - "description": "updated literal property description", - "min_count": 1, - "max_count": 2, - "path": "description", - "datatype": "C27" -}""" - -private const val updateResourceTemplatePropertyJson = """{ - "label": "updated resource property label", - "placeholder": "updated resource property placeholder", - "description": "updated resource property description", - "min_count": 2, - "max_count": 5, - "path": "P27", - "class": "C28" -}""" diff --git a/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/TemplateInstanceControllerIntegrationTest.kt b/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/TemplateInstanceControllerIntegrationTest.kt index b104d8b9e..b02ef6a6b 100644 --- a/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/TemplateInstanceControllerIntegrationTest.kt +++ b/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/TemplateInstanceControllerIntegrationTest.kt @@ -9,6 +9,7 @@ import org.orkg.common.ObservatoryId import org.orkg.common.OrganizationId import org.orkg.common.PageRequests import org.orkg.common.ThingId +import org.orkg.common.testing.fixtures.Assets.requestJson import org.orkg.community.input.ContributorUseCases import org.orkg.community.input.ObservatoryUseCases import org.orkg.community.input.OrganizationUseCases @@ -198,23 +199,10 @@ internal class TemplateInstanceControllerIntegrationTest : MockMvcBaseTest("temp ).single().id put("/api/templates/{id}/instances/{instanceId}", id, "R6458") - .content(updateTemplateInstanceJson) + .content(requestJson("orkg/updateTemplateInstance")) .accept(TEMPLATE_INSTANCE_JSON_V1) .contentType(TEMPLATE_INSTANCE_JSON_V1) .perform() .andExpect(status().isNoContent) } } - -private const val updateTemplateInstanceJson = """{ - "resources": null, - "literals": { - "#temp1": "https://orkg.org/" - }, - "predicates": null, - "lists": null, - "classes": null, - "statements": { - "url": ["#temp1"] - } -}""" diff --git a/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/VisualizationControllerIntegrationTest.kt b/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/VisualizationControllerIntegrationTest.kt index 79c89674f..d8baaca61 100644 --- a/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/VisualizationControllerIntegrationTest.kt +++ b/rest-api-server/src/integrationTest/kotlin/org/orkg/contenttypes/adapter/input/rest/VisualizationControllerIntegrationTest.kt @@ -7,6 +7,7 @@ import org.junit.jupiter.api.Test import org.orkg.common.ObservatoryId import org.orkg.common.OrganizationId import org.orkg.common.ThingId +import org.orkg.common.testing.fixtures.Assets.requestJson import org.orkg.community.input.ContributorUseCases import org.orkg.community.input.ObservatoryUseCases import org.orkg.community.input.OrganizationUseCases @@ -144,48 +145,10 @@ internal class VisualizationControllerIntegrationTest : MockMvcBaseTest("visuali @TestWithMockUser fun create() { post("/api/visualizations") - .content(createVisualizationJson) + .content(requestJson("orkg/createVisualization")) .accept(VISUALIZATION_JSON_V2) .contentType(VISUALIZATION_JSON_V2) .perform() .andExpect(status().isCreated) } } - -private const val createVisualizationJson = """{ - "title": "example visualization", - "description": "visualization description", - "authors": [ - { - "name": "Author with id", - "id": "R123" - }, - { - "name": "Author with orcid", - "identifiers": { - "orcid": ["0000-1111-2222-3333"] - } - }, - { - "name": "Author with id and orcid", - "id": "R456", - "identifiers": { - "orcid": ["1111-2222-3333-4444"] - } - }, - { - "name": "Author with homepage", - "homepage": "https://example.org/author" - }, - { - "name": "Author that just has a name" - } - ], - "observatories": [ - "1afefdd0-5c09-4c9c-b718-2b35316b56f3" - ], - "organizations": [ - "edc18168-c4ee-4cb8-a98a-136f748e912e" - ], - "extraction_method": "MANUAL" -}""" diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createComparison.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createComparison.json new file mode 100644 index 000000000..3a870f115 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createComparison.json @@ -0,0 +1,107 @@ +{ + "title": "example comparison", + "description": "comparison description", + "research_fields": [ + "R12" + ], + "authors": [ + { + "name": "Author with id", + "id": "R123" + }, + { + "name": "Author with orcid", + "identifiers": { + "orcid": ["0000-1111-2222-3333"] + } + }, + { + "name": "Author with id and orcid", + "id": "R456", + "identifiers": { + "orcid": ["1111-2222-3333-4444"] + } + }, + { + "name": "Author with homepage", + "homepage": "https://example.org/author" + }, + { + "name": "Author that just has a name" + } + ], + "sdgs": ["SDG_1", "SDG_2"], + "contributions": [ + "R6541", "R5364", "R9786", "R3120" + ], + "config": { + "contributions": [ + "R456789", + "R987654" + ], + "predicates": [], + "transpose": false, + "type": "MERGE" + }, + "data": { + "contributions": [ + { + "active": true, + "id": "R456789", + "label": "Contribution 1", + "paper_id": "R456", + "paper_label": "Paper 1", + "paper_year": 2024 + }, + { + "active": true, + "id": "R987654", + "label": "Contribution 1", + "paper_id": "R789", + "paper_label": "Paper 2", + "paper_year": 2022 + } + ], + "data": { + "P32": [ + [ + { + "_class": "resource", + "classes": ["Problem"], + "id": "R192326", + "label": "Covid-19 Pandemic Ontology Development", + "path": [ + "R187004", + "P32" + ], + "path_labels": [ + "Contribution 1", + "research problem" + ] + } + ] + ] + }, + "predicates": [ + { + "active": true, + "id": "P32", + "label": "research problem", + "n_contributions": 2, + "similar_predicates": ["P15"] + } + ] + }, + "references": [ + "https://orkg.org/resources/R1000", + "paper citation" + ], + "observatories": [ + "1afefdd0-5c09-4c9c-b718-2b35316b56f3" + ], + "organizations": [ + "edc18168-c4ee-4cb8-a98a-136f748e912e" + ], + "is_anonymized": false, + "extraction_method": "MANUAL" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createContribution.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createContribution.json new file mode 100644 index 000000000..22e63c6bb --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createContribution.json @@ -0,0 +1,57 @@ +{ + "resources": { + "#temp1": { + "label": "MOTO", + "classes": ["Result"] + } + }, + "literals": { + "#temp2": { + "label": "0.1", + "data_type": "xsd:decimal" + } + }, + "predicates": { + "#temp3": { + "label": "hasResult", + "description": "has result" + } + }, + "lists": { + "#temp4": { + "label": "list", + "elements": ["#temp1", "C123"] + } + }, + "contribution": { + "label": "Contribution 1", + "statements": { + "HAS_EVALUATION": [ + { + "id": "#temp1" + }, + { + "id": "R3004", + "statements": { + "#temp3": [ + { + "id": "R3003" + }, + { + "id": "#temp2" + }, + { + "id": "#temp4" + } + ], + "P32": [ + { + "id": "#temp2" + } + ] + } + } + ] + } + } +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createLiteratureList.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createLiteratureList.json new file mode 100644 index 000000000..aa9ad7837 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createLiteratureList.json @@ -0,0 +1,59 @@ +{ + "title": "example literature list", + "research_fields": [ + "R12" + ], + "authors": [ + { + "name": "Author with id", + "id": "R123" + }, + { + "name": "Author with orcid", + "identifiers": { + "orcid": ["0000-1111-2222-3333"] + } + }, + { + "name": "Author with id and orcid", + "id": "R456", + "identifiers": { + "orcid": ["1111-2222-3333-4444"] + } + }, + { + "name": "Author with homepage", + "homepage": "https://example.org/author" + }, + { + "name": "Author that just has a name" + } + ], + "sdgs": ["SDG_1", "SDG_2"], + "observatories": [ + "1afefdd0-5c09-4c9c-b718-2b35316b56f3" + ], + "organizations": [ + "edc18168-c4ee-4cb8-a98a-136f748e912e" + ], + "extraction_method": "MANUAL", + "sections": [ + { + "heading": "this is a heading", + "heading_size": 2, + "text": "text contents of this section" + }, + { + "entries": [ + { + "id": "R3003", + "description": "example description" + }, + { + "id": "R3004", + "description": null + } + ] + } + ] +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createLiteratureListListSection.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createLiteratureListListSection.json new file mode 100644 index 000000000..752f1b9d5 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createLiteratureListListSection.json @@ -0,0 +1,16 @@ +{ + "entries": [ + { + "id": "R3005", + "description": "example description" + }, + { + "id": "R3004", + "description": null + }, + { + "id": "R3003", + "description": null + } + ] +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createLiteratureListTextSection.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createLiteratureListTextSection.json new file mode 100644 index 000000000..a58be558f --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createLiteratureListTextSection.json @@ -0,0 +1,5 @@ +{ + "heading": "text section heading", + "heading_size": 2, + "text": "text section contents" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createNumberLiteralTemplateProperty.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createNumberLiteralTemplateProperty.json new file mode 100644 index 000000000..f901ee477 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createNumberLiteralTemplateProperty.json @@ -0,0 +1,11 @@ +{ + "label": "number literal property label", + "placeholder": "number literal property placeholder", + "description": "number literal property description", + "min_count": 1, + "max_count": 2, + "min_inclusive": -1, + "max_inclusive": 10, + "path": "P24", + "datatype": "Integer" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createOtherLiteralTemplateProperty.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createOtherLiteralTemplateProperty.json new file mode 100644 index 000000000..710f54434 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createOtherLiteralTemplateProperty.json @@ -0,0 +1,9 @@ +{ + "label": "literal property label", + "placeholder": "literal property placeholder", + "description": "literal property description", + "min_count": 1, + "max_count": 2, + "path": "P24", + "datatype": "C25" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createPaper.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createPaper.json new file mode 100644 index 000000000..6ce8e92e1 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createPaper.json @@ -0,0 +1,115 @@ +{ + "title": "example paper", + "research_fields": [ + "R12" + ], + "identifiers": { + "doi": ["10.48550/arXiv.2304.05327"] + }, + "publication_info": { + "published_month": 5, + "published_year": 2015, + "published_in": "conference", + "url": "https://www.example.org" + }, + "authors": [ + { + "name": "Author with id", + "id": "R123" + }, + { + "name": "Author with orcid", + "identifiers": { + "orcid": ["0000-1111-2222-3333"] + } + }, + { + "name": "Author with id and orcid", + "id": "R456", + "identifiers": { + "orcid": ["1111-2222-3333-4444"] + } + }, + { + "name": "Author with homepage", + "homepage": "https://example.org/author" + }, + { + "name": "Author that just has a name" + } + ], + "sdgs": ["SDG_1", "SDG_2"], + "mentionings": ["R3003", "R3004"], + "observatories": [ + "1afefdd0-5c09-4c9c-b718-2b35316b56f3" + ], + "organizations": [ + "edc18168-c4ee-4cb8-a98a-136f748e912e" + ], + "contents": { + "resources": { + "#temp1": { + "label": "MOTO", + "classes": ["Result"] + } + }, + "literals": { + "#temp2": { + "label": "0.1", + "data_type": "xsd:decimal" + } + }, + "predicates": { + "#temp3": { + "label": "hasResult", + "description": "has result" + } + }, + "lists": { + "#temp4": { + "label": "list", + "elements": ["#temp1", "C123"] + } + }, + "contributions": [ + { + "label": "Contribution 1", + "classes": ["C123"], + "statements": { + "P32": [ + { + "id": "R3003" + } + ], + "HAS_EVALUATION": [ + { + "id": "#temp1" + }, + { + "id": "R3004", + "statements": { + "#temp3": [ + { + "id": "R3003" + }, + { + "id": "#temp2" + }, + { + "id": "#temp4" + } + ], + "P32": [ + { + "id": "#temp2" + } + ] + } + } + ] + } + } + ] + }, + "extraction_method": "MANUAL" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createResourceTemplateProperty.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createResourceTemplateProperty.json new file mode 100644 index 000000000..da18bd660 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createResourceTemplateProperty.json @@ -0,0 +1,9 @@ +{ + "label": "resource property label", + "placeholder": "resource property placeholder", + "description": "resource property description", + "min_count": 3, + "max_count": 4, + "path": "P27", + "class": "C28" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createRosettaStoneStatement.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createRosettaStoneStatement.json new file mode 100644 index 000000000..89aaa194f --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createRosettaStoneStatement.json @@ -0,0 +1,59 @@ +{ + "template_id": "$templateId", + "context": "R789", + "subjects": ["R258", "R369", "#temp1"], + "objects": [ + ["R174", "#temp2", "#temp3"], + ["L123", "#temp4"], + ["L456", "#temp5"], + ["L789", "#temp6"], + ["R258", "R369", "#temp7"] + ], + "certainty": "HIGH", + "negated": false, + "resources": { + "#temp1": { + "label": "Subject Resource", + "classes": ["C28"] + } + }, + "predicates": { + "#temp2": { + "label": "hasResult", + "description": "has result" + } + }, + "classes": { + "#temp3": { + "label": "new class", + "uri": null + } + }, + "literals": { + "#temp4": { + "label": "0123456789", + "data_type": "xsd:string" + }, + "#temp5": { + "label": "1", + "data_type": "xsd:integer" + }, + "#temp6": { + "label": "some literal value", + "data_type": "http://orkg.org/orkg/class/C25" + } + }, + "lists": { + "#temp7": { + "label": "list", + "elements": ["#temp1", "C123"] + } + }, + "observatories": [ + "1afefdd0-5c09-4c9c-b718-2b35316b56f3" + ], + "organizations": [ + "edc18168-c4ee-4cb8-a98a-136f748e912e" + ], + "extraction_method": "MANUAL" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createRosettaStoneTemplate.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createRosettaStoneTemplate.json new file mode 100644 index 000000000..58d5b26f9 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createRosettaStoneTemplate.json @@ -0,0 +1,70 @@ +{ + "label": "rosetta stone template", + "description": "rosetta stone template description", + "formatted_label": "{0} {1} {2} {3} {4} {5}", + "example_usage": "example statement usage", + "properties": [ + { + "label": "subject position", + "placeholder": "subject", + "description": "subject", + "min_count": 1, + "max_count": 4, + "path": "hasSubjectPosition", + "class": "C28" + }, + { + "label": "property label", + "placeholder": "property placeholder", + "description": "property description", + "min_count": 1, + "max_count": 2, + "path": "hasObjectPosition" + }, + { + "label": "string literal property label", + "placeholder": "string literal property placeholder", + "description": "string literal property description", + "min_count": 1, + "max_count": 2, + "pattern": "\\d+", + "path": "hasObjectPosition", + "datatype": "String" + }, + { + "label": "number literal property label", + "placeholder": "number literal property placeholder", + "description": "number literal property description", + "min_count": 1, + "max_count": 2, + "min_inclusive": -1, + "max_inclusive": 10, + "path": "hasObjectPosition", + "datatype": "Integer" + }, + { + "label": "literal property label", + "placeholder": "literal property placeholder", + "description": "literal property description", + "min_count": 1, + "max_count": 2, + "path": "hasObjectPosition", + "datatype": "C25" + }, + { + "label": "resource property label", + "placeholder": "resource property placeholder", + "description": "resource property description", + "min_count": 3, + "max_count": 4, + "path": "hasObjectPosition", + "class": "C28" + } + ], + "observatories": [ + "1afefdd0-5c09-4c9c-b718-2b35316b56f3" + ], + "organizations": [ + "edc18168-c4ee-4cb8-a98a-136f748e912e" + ] +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createSmartReview.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createSmartReview.json new file mode 100644 index 000000000..e56868058 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createSmartReview.json @@ -0,0 +1,72 @@ +{ + "title": "example smart review", + "research_fields": [ + "R12" + ], + "authors": [ + { + "name": "Author with id", + "id": "R123" + }, + { + "name": "Author with orcid", + "identifiers": { + "orcid": ["0000-1111-2222-3333"] + } + }, + { + "name": "Author with id and orcid", + "id": "R456", + "identifiers": { + "orcid": ["1111-2222-3333-4444"] + } + }, + { + "name": "Author with homepage", + "homepage": "https://example.org/author" + }, + { + "name": "Author that just has a name" + } + ], + "sdgs": ["SDG_1", "SDG_2"], + "observatories": [ + "1afefdd0-5c09-4c9c-b718-2b35316b56f3" + ], + "organizations": [ + "edc18168-c4ee-4cb8-a98a-136f748e912e" + ], + "extraction_method": "MANUAL", + "sections": [ + { + "heading": "comparison section heading", + "comparison": "R6416" + }, + { + "heading": "visualization section heading", + "visualization": "R215648" + }, + { + "heading": "resource section heading", + "resource": "R14565" + }, + { + "heading": "predicate section heading", + "predicate": "R15696541" + }, + { + "heading": "ontology section heading", + "entities": ["R1", "P1"], + "predicates": ["P1"] + }, + { + "heading": "Heading", + "class": "Introduction", + "text": "text section contents" + } + ], + "references": [ + "@misc{R615465, title = {reference 1}}", + "@misc{R154146, title = {reference 2}}" + ] +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createSmartReviewComparisonSection.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createSmartReviewComparisonSection.json new file mode 100644 index 000000000..ffa450c13 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createSmartReviewComparisonSection.json @@ -0,0 +1,4 @@ +{ + "heading": "new comparison section heading", + "comparison": "R6416" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createSmartReviewOntologySection.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createSmartReviewOntologySection.json new file mode 100644 index 000000000..10f0dfbdd --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createSmartReviewOntologySection.json @@ -0,0 +1,5 @@ +{ + "heading": "new ontology section heading", + "entities": ["R1", "P1"], + "predicates": ["P1"] +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createSmartReviewPredicateSection.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createSmartReviewPredicateSection.json new file mode 100644 index 000000000..4e82cd9fa --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createSmartReviewPredicateSection.json @@ -0,0 +1,4 @@ +{ + "heading": "new predicate section heading", + "predicate": "R15696541" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createSmartReviewResourceSection.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createSmartReviewResourceSection.json new file mode 100644 index 000000000..b89fa70f9 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createSmartReviewResourceSection.json @@ -0,0 +1,4 @@ +{ + "heading": "new resource section heading", + "resource": "R14565" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createSmartReviewTextSection.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createSmartReviewTextSection.json new file mode 100644 index 000000000..a4bef231e --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createSmartReviewTextSection.json @@ -0,0 +1,5 @@ +{ + "heading": "new text section heading", + "class": "Epilogue", + "text": "Epilogue text section contents" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createSmartReviewVisualizationSection.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createSmartReviewVisualizationSection.json new file mode 100644 index 000000000..4773ae5e5 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createSmartReviewVisualizationSection.json @@ -0,0 +1,4 @@ +{ + "heading": "new visualization section heading", + "visualization": "R215648" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createStringLiteralTemplateProperty.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createStringLiteralTemplateProperty.json new file mode 100644 index 000000000..61ff76848 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createStringLiteralTemplateProperty.json @@ -0,0 +1,10 @@ +{ + "label": "string literal property label", + "placeholder": "string literal property placeholder", + "description": "string literal property description", + "min_count": 1, + "max_count": 2, + "pattern": "\\d+", + "path": "P24", + "datatype": "String" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createTemplate.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createTemplate.json new file mode 100644 index 000000000..b68a40559 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createTemplate.json @@ -0,0 +1,68 @@ +{ + "label": "example template", + "description": "template description", + "formatted_label": "{P32}", + "target_class": "C123", + "relations": { + "research_fields": ["R12"], + "research_problems": ["R15"], + "predicate": "P32" + }, + "properties": [ + { + "label": "property label", + "placeholder": "property placeholder", + "description": "property description", + "min_count": 1, + "max_count": 2, + "path": "P24" + }, + { + "label": "string literal property label", + "placeholder": "string literal property placeholder", + "description": "string literal property description", + "min_count": 1, + "max_count": 2, + "pattern": "\\d+", + "path": "P24", + "datatype": "String" + }, + { + "label": "number literal property label", + "placeholder": "number literal property placeholder", + "description": "number literal property description", + "min_count": 1, + "max_count": 2, + "min_inclusive": -1, + "max_inclusive": 10, + "path": "P24", + "datatype": "Integer" + }, + { + "label": "literal property label", + "placeholder": "literal property placeholder", + "description": "literal property description", + "min_count": 1, + "max_count": 2, + "path": "P24", + "datatype": "C25" + }, + { + "label": "resource property label", + "placeholder": "resource property placeholder", + "description": "resource property description", + "min_count": 3, + "max_count": 4, + "path": "P27", + "class": "C28" + } + ], + "is_closed": false, + "observatories": [ + "1afefdd0-5c09-4c9c-b718-2b35316b56f3" + ], + "organizations": [ + "edc18168-c4ee-4cb8-a98a-136f748e912e" + ], + "extraction_method": "AUTOMATIC" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createUntypedTemplateProperty.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createUntypedTemplateProperty.json new file mode 100644 index 000000000..08316ec51 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createUntypedTemplateProperty.json @@ -0,0 +1,8 @@ +{ + "label": "property label", + "placeholder": "property placeholder", + "description": "property description", + "min_count": 1, + "max_count": 2, + "path": "P24" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createVisualization.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createVisualization.json new file mode 100644 index 000000000..c6b1722e5 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/createVisualization.json @@ -0,0 +1,37 @@ +{ + "title": "example visualization", + "description": "visualization description", + "authors": [ + { + "name": "Author with id", + "id": "R123" + }, + { + "name": "Author with orcid", + "identifiers": { + "orcid": ["0000-1111-2222-3333"] + } + }, + { + "name": "Author with id and orcid", + "id": "R456", + "identifiers": { + "orcid": ["1111-2222-3333-4444"] + } + }, + { + "name": "Author with homepage", + "homepage": "https://example.org/author" + }, + { + "name": "Author that just has a name" + } + ], + "observatories": [ + "1afefdd0-5c09-4c9c-b718-2b35316b56f3" + ], + "organizations": [ + "edc18168-c4ee-4cb8-a98a-136f748e912e" + ], + "extraction_method": "MANUAL" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateComparison.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateComparison.json new file mode 100644 index 000000000..0c03dc46f --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateComparison.json @@ -0,0 +1,117 @@ +{ + "title": "updated comparison", + "description": "updated comparison description", + "research_fields": [ + "R13" + ], + "authors": [ + { + "name": "Other author with id", + "id": "R124" + }, + { + "name": "Author with orcid", + "identifiers": { + "orcid": ["0000-1111-2222-3333"] + } + }, + { + "name": "Author with id and orcid", + "id": "R456", + "identifiers": { + "orcid": ["1111-2222-3333-4444"] + } + }, + { + "name": "Author with homepage", + "homepage": "https://example.org/author" + }, + { + "name": "Author that just has a name" + } + ], + "sdgs": ["SDG_3", "SDG_2"], + "contributions": [ + "R6541", "R5364", "R3120", "R7864" + ], + "config": { + "contributions": [ + "R456790", + "R987654", + "R1546864" + ], + "predicates": [], + "transpose": false, + "type": "PATH" + }, + "data": { + "contributions": [ + { + "active": true, + "id": "R456790", + "label": "Contribution 2", + "paper_id": "R456", + "paper_label": "Paper 1", + "paper_year": 2024 + }, + { + "active": true, + "id": "R987654", + "label": "Contribution 1", + "paper_id": "R789", + "paper_label": "Paper 2", + "paper_year": 2022 + }, + { + "active": true, + "id": "R1546864", + "label": "Contribution 1", + "paper_id": "R258", + "paper_label": "Paper 3", + "paper_year": 2023 + } + ], + "data": { + "P32": [ + [ + { + "_class": "resource", + "classes": ["Problem"], + "id": "R192326", + "label": "Covid-19 Pandemic Ontology Development", + "path": [ + "R187004", + "P32" + ], + "path_labels": [ + "Contribution 1", + "research problem" + ] + } + ] + ] + }, + "predicates": [ + { + "active": true, + "id": "P32", + "label": "research problem", + "n_contributions": 2, + "similar_predicates": ["P15"] + } + ] + }, + "references": [ + "other paper citation", + "paper citation" + ], + "observatories": [ + "33d0776f-59ad-465f-a22c-cd794694edc6" + ], + "organizations": [ + "dc9a860c-1a1b-4977-bd6a-9dc21de46df6" + ], + "is_anonymized": true, + "extraction_method": "AUTOMATIC", + "visibility": "DELETED" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateLiteratureList.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateLiteratureList.json new file mode 100644 index 000000000..b0ce4d23f --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateLiteratureList.json @@ -0,0 +1,64 @@ +{ + "title": "updated literature list title", + "research_fields": [ + "R194" + ], + "authors": [ + { + "name": "Author with id", + "id": "R123" + }, + { + "name": "Author with orcid", + "identifiers": { + "orcid": ["0000-1111-2222-3333"] + } + }, + { + "name": "Author with id and orcid", + "id": "R456", + "identifiers": { + "orcid": ["4444-3333-2222-1111"] + } + }, + { + "name": "Author with homepage", + "homepage": "https://example.org/author" + }, + { + "name": "Another author that just has a name" + } + ], + "sdgs": ["SDG_3", "SDG_4"], + "observatories": [ + "1afefdd0-5c09-4c9c-b718-2b35316b56f3" + ], + "organizations": [ + "edc18168-c4ee-4cb8-a98a-136f748e912e" + ], + "extraction_method": "UNKNOWN", + "sections": [ + { + "heading": "updated heading", + "heading_size": 3, + "text": "updated text contents" + }, + { + "entries": [ + { + "id": "R3004", + "description": "new description" + }, + { + "id": "R3003", + "description": null + }, + { + "id": "R3005", + "description": "updated example description" + } + ] + } + ], + "visibility": "DELETED" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateLiteratureListListSection.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateLiteratureListListSection.json new file mode 100644 index 000000000..314c3f122 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateLiteratureListListSection.json @@ -0,0 +1,16 @@ +{ + "entries": [ + { + "id": "R3003", + "description": null + }, + { + "id": "R3004", + "description": "new description" + }, + { + "id": "R3005", + "description": "updated example description" + } + ] +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateLiteratureListTextSection.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateLiteratureListTextSection.json new file mode 100644 index 000000000..a8afc94c9 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateLiteratureListTextSection.json @@ -0,0 +1,5 @@ +{ + "heading": "updated text section heading", + "heading_size": 3, + "text": "updated text section contents" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateNumberLiteralTemplateProperty.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateNumberLiteralTemplateProperty.json new file mode 100644 index 000000000..f59b685ea --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateNumberLiteralTemplateProperty.json @@ -0,0 +1,11 @@ +{ + "label": "updated number literal property label", + "placeholder": "updated number literal property placeholder", + "description": "updated number literal property description", + "min_count": 1, + "max_count": 2, + "min_inclusive": -5, + "max_inclusive": 15.5, + "path": "P24", + "datatype": "Decimal" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateOtherLiteralTemplateProperty.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateOtherLiteralTemplateProperty.json new file mode 100644 index 000000000..da20f08d4 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateOtherLiteralTemplateProperty.json @@ -0,0 +1,9 @@ +{ + "label": "updated literal property label", + "placeholder": "updated literal property placeholder", + "description": "updated literal property description", + "min_count": 1, + "max_count": 2, + "path": "description", + "datatype": "C27" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updatePaper.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updatePaper.json new file mode 100644 index 000000000..214344f1a --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updatePaper.json @@ -0,0 +1,53 @@ +{ + "title": "updated paper title", + "research_fields": [ + "R194" + ], + "identifiers": { + "doi": ["10.48550/arXiv.2304.05328"], + "isbn": ["978-123456789-0"], + "issn": ["1234-5678"] + }, + "publication_info": { + "published_month": 6, + "published_year": 2016, + "published_in": "other conference", + "url": "https://www.conference.org" + }, + "authors": [ + { + "name": "Author with id", + "id": "R123" + }, + { + "name": "Author with orcid", + "identifiers": { + "orcid": ["0000-1111-2222-3333"] + } + }, + { + "name": "Author with id and orcid", + "id": "R456", + "identifiers": { + "orcid": ["4444-3333-2222-1111"] + } + }, + { + "name": "Author with homepage", + "homepage": "https://example.org/author" + }, + { + "name": "Another author that just has a name" + } + ], + "sdgs": ["SDG_3", "SDG_4"], + "mentionings": ["R3004", "R3005"], + "observatories": [ + "1afefdd0-5c09-4c9c-b718-2b35316b56f3" + ], + "organizations": [ + "edc18168-c4ee-4cb8-a98a-136f748e912e" + ], + "visibility": "DELETED", + "verified": false +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateResourceTemplateProperty.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateResourceTemplateProperty.json new file mode 100644 index 000000000..cb5927cae --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateResourceTemplateProperty.json @@ -0,0 +1,9 @@ +{ + "label": "updated resource property label", + "placeholder": "updated resource property placeholder", + "description": "updated resource property description", + "min_count": 2, + "max_count": 5, + "path": "P27", + "class": "C28" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateRosettaStoneStatement.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateRosettaStoneStatement.json new file mode 100644 index 000000000..06b6e9071 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateRosettaStoneStatement.json @@ -0,0 +1,57 @@ +{ + "subjects": ["R369", "R258", "#temp1"], + "objects": [ + ["#temp2", "R174", "#temp3"], + ["#temp4", "L123"], + ["#temp5", "L456"], + ["#temp6", "L789"], + ["R369", "R258", "#temp7"] + ], + "certainty": "MODERATE", + "negated": false, + "resources": { + "#temp1": { + "label": "Updated Subject Resource", + "classes": ["C28"] + } + }, + "predicates": { + "#temp2": { + "label": "hasResult", + "description": "has result too" + } + }, + "classes": { + "#temp3": { + "label": "updated new class", + "uri": null + } + }, + "literals": { + "#temp4": { + "label": "9876543210", + "data_type": "xsd:string" + }, + "#temp5": { + "label": "4", + "data_type": "xsd:integer" + }, + "#temp6": { + "label": "some updated literal value", + "data_type": "http://orkg.org/orkg/class/C25" + } + }, + "lists": { + "#temp7": { + "label": "list", + "elements": ["C123", "#temp1"] + } + }, + "observatories": [ + "1afefdd0-5c09-4c9c-b718-2b35316b56f3" + ], + "organizations": [ + "edc18168-c4ee-4cb8-a98a-136f748e912e" + ], + "extraction_method": "AUTOMATIC" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateRosettaStoneTemplate.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateRosettaStoneTemplate.json new file mode 100644 index 000000000..dd3080d40 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateRosettaStoneTemplate.json @@ -0,0 +1,70 @@ +{ + "label": "updated rosetta stone template", + "description": "updated rosetta stone template description", + "formatted_label": "updated {0} {1} {2} {3} {4} {5}", + "example_usage": "updated example statement usage", + "properties": [ + { + "label": "updated subject position", + "placeholder": "updated subject", + "description": "updated subject", + "min_count": 2, + "max_count": 5, + "path": "hasSubjectPosition", + "class": "C28" + }, + { + "label": "updated property label", + "placeholder": "updated property placeholder", + "description": "updated property description", + "min_count": 2, + "max_count": 3, + "path": "hasObjectPosition" + }, + { + "label": "updated string literal property label", + "placeholder": "updated string literal property placeholder", + "description": "updated string literal property description", + "min_count": 2, + "max_count": 3, + "pattern": "\\w+", + "path": "hasObjectPosition", + "datatype": "String" + }, + { + "label": "updated number literal property label", + "placeholder": "updated number literal property placeholder", + "description": "updated number literal property description", + "min_count": 2, + "max_count": 3, + "min_inclusive": 0, + "max_inclusive": 11, + "path": "hasObjectPosition", + "datatype": "Integer" + }, + { + "label": "updated literal property label", + "placeholder": "updated literal property placeholder", + "description": "updated literal property description", + "min_count": 2, + "max_count": 3, + "path": "hasObjectPosition", + "datatype": "C25" + }, + { + "label": "updated resource property label", + "placeholder": "updated resource property placeholder", + "description": "updated resource property description", + "min_count": 4, + "max_count": 5, + "path": "hasObjectPosition", + "class": "C28" + } + ], + "observatories": [ + "1afefdd0-5c09-4c9c-b718-2b35316b56f3" + ], + "organizations": [ + "edc18168-c4ee-4cb8-a98a-136f748e912e" + ] +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateSmartReview.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateSmartReview.json new file mode 100644 index 000000000..c49362fd2 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateSmartReview.json @@ -0,0 +1,73 @@ +{ + "title": "updated smart review title", + "research_fields": [ + "R194" + ], + "authors": [ + { + "name": "Author with id", + "id": "R123" + }, + { + "name": "Author with orcid", + "identifiers": { + "orcid": ["0000-1111-2222-3333"] + } + }, + { + "name": "Author with id and orcid", + "id": "R456", + "identifiers": { + "orcid": ["4444-3333-2222-1111"] + } + }, + { + "name": "Author with homepage", + "homepage": "https://example.org/author" + }, + { + "name": "Another author that just has a name" + } + ], + "sdgs": ["SDG_3", "SDG_4"], + "observatories": [ + "1afefdd0-5c09-4c9c-b718-2b35316b56f3" + ], + "organizations": [ + "edc18168-c4ee-4cb8-a98a-136f748e912e" + ], + "extraction_method": "UNKNOWN", + "sections": [ + { + "heading": "updated comparison section heading", + "comparison": "R26416" + }, + { + "heading": "updated visualization section heading", + "visualization": "R2215648" + }, + { + "heading": "updated resource section heading", + "resource": "R214565" + }, + { + "heading": "updated predicate section heading", + "predicate": "R215696541" + }, + { + "heading": "updated ontology section heading", + "entities": ["R21", "P1"], + "predicates": ["P21"] + }, + { + "heading": "updated text section heading", + "class": "Introduction", + "text": "Introduction text section contents" + } + ], + "references": [ + "@misc{R615465, title = {updated reference 1}}", + "@misc{R154146, title = {updated reference 2}}" + ], + "visibility": "DELETED" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateSmartReviewComparisonSection.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateSmartReviewComparisonSection.json new file mode 100644 index 000000000..c563da8d3 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateSmartReviewComparisonSection.json @@ -0,0 +1,4 @@ +{ + "heading": "updated comparison section heading", + "comparison": "R26416" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateSmartReviewOntologySection.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateSmartReviewOntologySection.json new file mode 100644 index 000000000..b0e6ee751 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateSmartReviewOntologySection.json @@ -0,0 +1,5 @@ +{ + "heading": "updated ontology section heading", + "entities": ["R21", "P1"], + "predicates": ["P21"] +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateSmartReviewPredicateSection.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateSmartReviewPredicateSection.json new file mode 100644 index 000000000..dbe1fa28e --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateSmartReviewPredicateSection.json @@ -0,0 +1,4 @@ +{ + "heading": "updated predicate section heading", + "predicate": "R215696541" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateSmartReviewResourceSection.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateSmartReviewResourceSection.json new file mode 100644 index 000000000..a210045b8 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateSmartReviewResourceSection.json @@ -0,0 +1,4 @@ +{ + "heading": "updated resource section heading", + "resource": "R214565" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateSmartReviewTextSection.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateSmartReviewTextSection.json new file mode 100644 index 000000000..3b3ccba41 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateSmartReviewTextSection.json @@ -0,0 +1,5 @@ +{ + "heading": "updated text section heading", + "class": "Introduction", + "text": "Introduction text section contents" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateSmartReviewVisualizationSection.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateSmartReviewVisualizationSection.json new file mode 100644 index 000000000..d09205f2a --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateSmartReviewVisualizationSection.json @@ -0,0 +1,4 @@ +{ + "heading": "updated visualization section heading", + "visualization": "R2215648" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateStringLiteralTemplateProperty.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateStringLiteralTemplateProperty.json new file mode 100644 index 000000000..634388d32 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateStringLiteralTemplateProperty.json @@ -0,0 +1,10 @@ +{ + "label": "updated string literal property label", + "placeholder": "updated string literal property placeholder", + "description": "updated string literal property description", + "min_count": 1, + "max_count": 2, + "pattern": "\\w+", + "path": "P24", + "datatype": "String" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateTemplate.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateTemplate.json new file mode 100644 index 000000000..48ee46a26 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateTemplate.json @@ -0,0 +1,69 @@ +{ + "label": "updated example template", + "description": "updated template description", + "formatted_label": "{P34}", + "target_class": "C456", + "relations": { + "research_fields": ["R13"], + "research_problems": ["R16"], + "predicate": "P31" + }, + "properties": [ + { + "label": "updated property label", + "placeholder": null, + "description": null, + "min_count": 4, + "max_count": 7, + "path": "P24" + }, + { + "label": "updated resource property label", + "placeholder": "updated resource property placeholder", + "description": "updated resource property description", + "min_count": 3, + "max_count": 4, + "path": "P27", + "class": "C28" + }, + { + "label": "updated string literal property label", + "placeholder": "updated string literal property placeholder", + "description": "updated string literal property description", + "min_count": 1, + "max_count": 2, + "pattern": "\\w+", + "path": "P24", + "datatype": "String" + }, + { + "label": "updated literal property label", + "placeholder": "updated literal property placeholder", + "description": "updated literal property description", + "min_count": 1, + "max_count": 2, + "path": "P24", + "datatype": "C25" + }, + { + "label": "updated number literal property label", + "placeholder": "updated number literal property placeholder", + "description": "updated number literal property description", + "min_count": 1, + "max_count": 2, + "min_inclusive": -5, + "max_inclusive": 15.5, + "path": "P24", + "datatype": "Decimal" + } + ], + "is_closed": false, + "observatories": [ + "1afefdd0-5c09-4c9c-b718-2b35316b56f3" + ], + "organizations": [ + "edc18168-c4ee-4cb8-a98a-136f748e912e" + ], + "extraction_method": "MANUAL", + "visibility": "DELETED" +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateTemplateInstance.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateTemplateInstance.json new file mode 100644 index 000000000..cbcc5dabe --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateTemplateInstance.json @@ -0,0 +1,12 @@ +{ + "resources": null, + "literals": { + "#temp1": "https://orkg.org/" + }, + "predicates": null, + "lists": null, + "classes": null, + "statements": { + "url": ["#temp1"] + } +} diff --git a/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateUntypedTemplateProperty.json b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateUntypedTemplateProperty.json new file mode 100644 index 000000000..1b2d54716 --- /dev/null +++ b/rest-api-server/src/integrationTest/resources/assets/requests/orkg/updateUntypedTemplateProperty.json @@ -0,0 +1,8 @@ +{ + "label": "updated property label", + "placeholder": null, + "description": null, + "min_count": 4, + "max_count": 7, + "path": "P24" +}