Skip to content

Commit

Permalink
mod_ginger_rdf: Leave out empty translation strings in rdf output
Browse files Browse the repository at this point in the history
  • Loading branch information
robvandenbogaard committed May 14, 2024
1 parent 448e41d commit d4725f0
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions modules/mod_ginger_rdf/models/m_rdf_export.erl
Original file line number Diff line number Diff line change
Expand Up @@ -127,16 +127,21 @@ translations_to_rdf(Predicate, Translations, Context) ->

-spec translations_to_rdf(m_rdf:resource() | undefined, m_rdf:predicate(), proplists:proplist(), z:context()) -> [m_rdf:triple()].
translations_to_rdf(Subject, Predicate, Translations, Context) ->
lists:map(
lists:filtermap(
fun({Language, Value}) ->
#triple{
subject = Subject,
predicate = Predicate,
object = #rdf_value{
language = Language,
value = Value
}
}
case z_utils:is_empty(Value) of
true -> false;
false ->
{true, #triple{
subject = Subject,
predicate = Predicate,
object = #rdf_value{
language = Language,
value = Value
}
}
}
end
end,
m_ginger_rest:translations(Translations, Context)
).
Expand Down

0 comments on commit d4725f0

Please sign in to comment.