lapidus
(Daniel)
September 3, 2021, 12:47pm
1
Is there anything in Stardog that helps resolve "Fallback languages"?
There's a longer discussion here:
opened 07:33AM - 03 Apr 19 UTC
enhancement
Wikidata describes a clear use case for resolving labels for entities and fallin… g back when a language would not be available. See https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries#US_presidents_and_their_spouses
Can we come up with a proposal that standardizes this for all SPARQL query processors instead of having to rely on service-specific "connectors"?
In our use case we would always look for an "English fallback" for any non-english rdf:langString:
If English:
{
:a :name ?name . => "English name"
:a :description ?description => "English description"
}
If Swedish:
{
:a :name ?name . => "Swedish name or English if empty"
:a :description ?description => "Swedish description or English Fallback if empty"
}
So basically trying to fill each property with an English equivalent.
I've tried some options with BIND(LANGMATCHES...) etc. but it gets quite out of hand with 20 properties that all need the same fallback logic.
pavel
(Pavel Klinov)
September 6, 2021, 10:17am
2
Hi Daniel,
Apologies for the delay on this. Yes, it's a known issue and you're correct that encoding a solution in pure SPARQL gets cumbersome pretty quickly.
One Stardog-specific possibility would be to use a correlated subquery through the Stored Query Service: Stored Query Service | Stardog Documentation Latest
It'd be somewhat similar to the ui:label
function that Richard described in the issue you mentioned. Instead of a custom function, it'll be a stored subquery (it's a bit more flexible since it can return multiple values, if needed). Also it avoids the function purity issue that's discussed there. Note that the subquery must be correlated so that it "sees" the value of the resource for which it needs to retrieve the label.
Let us know the outcome if you decide to explore this,
Pavel
lapidus
(Daniel)
September 6, 2021, 1:13pm
3
Thank you! Will explore and report back!
system
(system)
Closed
September 20, 2021, 1:13pm
4
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.