Skip to content

Commit

Permalink
fix: force attributes compaction before being extracted #393
Browse files Browse the repository at this point in the history
  • Loading branch information
Houcem Kacem committed May 7, 2021
1 parent e573206 commit 22730f9
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -525,8 +525,10 @@ fun extractAttributeInstanceFromCompactedEntity(
attributeName: String,
datasetId: URI?
): CompactedJsonLdAttribute {
return if (compactedJsonLdEntity[attributeName] is List<*>) {
val attributePayload = compactedJsonLdEntity[attributeName] as List<CompactedJsonLdAttribute>
// Since some attributes cannot be well compacted, to be improved later
val compactedAttributeName = attributeName.extractShortTypeFromExpanded()
return if (compactedJsonLdEntity[compactedAttributeName] is List<*>) {
val attributePayload = compactedJsonLdEntity[compactedAttributeName] as List<CompactedJsonLdAttribute>
attributePayload.first { it["datasetId"] as String? == datasetId?.toString() }
} else compactedJsonLdEntity[attributeName]!! as CompactedJsonLdAttribute
} else compactedJsonLdEntity[compactedAttributeName]!! as CompactedJsonLdAttribute
}

0 comments on commit 22730f9

Please sign in to comment.