Fallback language?

Is there anything in Stardog that helps resolve "Fallback languages"?

There's a longer discussion here:

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. :sweat_smile:

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

Thank you! Will explore and report back!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.