diff --git a/shared/config/detekt/baseline.xml b/shared/config/detekt/baseline.xml
index 7676e8f70..c3deb4468 100644
--- a/shared/config/detekt/baseline.xml
+++ b/shared/config/detekt/baseline.xml
@@ -3,7 +3,7 @@
CyclomaticComplexMethod:ExceptionHandler.kt$ExceptionHandler$@ExceptionHandler fun transformErrorResponse(throwable: Throwable): ResponseEntity<ProblemDetail>
- LongMethod:ExpandedEntityTests.kt$ExpandedEntityTests$@Test fun `it should return simplified GeoJSON entities`()
+ LongMethod:CompactedEntityTests.kt$CompactedEntityTests$@Test fun `it should return the GeoJSON representation of simplified entities`()
LongMethod:QueryUtils.kt$private fun transformQQueryToSqlJsonPath( mainAttributePath: List<ExpandedTerm>, trailingAttributePath: List<ExpandedTerm>, operator: String, value: String )
LongParameterList:ApiResponses.kt$( body: String, count: Int, resourceUrl: String, paginationQuery: PaginationQuery, requestParams: MultiValueMap<String, String>, mediaType: MediaType, contexts: List<String> )
LongParameterList:ApiResponses.kt$( entities: Any, count: Int, resourceUrl: String, paginationQuery: PaginationQuery, requestParams: MultiValueMap<String, String>, mediaType: MediaType, contexts: List<String> )
diff --git a/shared/src/main/kotlin/com/egm/stellio/shared/model/CompactedEntity.kt b/shared/src/main/kotlin/com/egm/stellio/shared/model/CompactedEntity.kt
index 4ff3bdaae..781701e73 100644
--- a/shared/src/main/kotlin/com/egm/stellio/shared/model/CompactedEntity.kt
+++ b/shared/src/main/kotlin/com/egm/stellio/shared/model/CompactedEntity.kt
@@ -7,10 +7,9 @@ import com.egm.stellio.shared.util.JsonLdUtils.JSONLD_JSON_TERM
import com.egm.stellio.shared.util.JsonLdUtils.JSONLD_OBJECT
import com.egm.stellio.shared.util.JsonLdUtils.JSONLD_TYPE_TERM
import com.egm.stellio.shared.util.JsonLdUtils.JSONLD_VALUE_TERM
-import com.egm.stellio.shared.util.JsonLdUtils.NGSILD_GEOPROPERTY_TERM
-import com.egm.stellio.shared.util.JsonLdUtils.NGSILD_JSONPROPERTY_TERM
-import com.egm.stellio.shared.util.JsonLdUtils.NGSILD_PROPERTY_TERM
-import com.egm.stellio.shared.util.JsonLdUtils.NGSILD_RELATIONSHIP_TERM
+import com.egm.stellio.shared.util.JsonLdUtils.NGSILD_DATASET_ID_TERM
+import com.egm.stellio.shared.util.JsonLdUtils.NGSILD_DATASET_TERM
+import com.egm.stellio.shared.util.JsonLdUtils.NGSILD_NONE_TERM
import com.egm.stellio.shared.util.JsonLdUtils.NGSILD_SYSATTRS_TERMS
typealias CompactedEntity = Map
@@ -23,24 +22,36 @@ private fun simplifyRepresentation(value: Any): Any =
// an attribute with a single instance
is Map<*, *> -> simplifyValue(value as Map)
// an attribute with multiple instances
- is List<*> -> value.map {
- when (it) {
- is Map<*, *> -> simplifyValue(it as Map)
+ is List<*> -> {
+ when (value.first()) {
+ is Map<*, *> -> simplifyMultiInstanceAttribute(value as List