Help with simple SPARQL query getting strings of selected languages

Hi,

I'm having trouble contructing a basic query which selects a string so 
that it prefers one language, over others but always tries to return 
something.

So I have names

:item schema:name "name"@en
:item schema:name "nimi"@fi
:item schema:name "namn"

I need query that returns the English name ("name"@en) , but if not 
found the name without language ("namn"), and as last resort name in 
Finnish ("nimi"@fi)

This query returns one random name:

SELECT
?s
(SAMPLE(?s_label_g) as ?s_label)
?s_type
FROM <http://some_graph/>
WHERE
{
     ?s a ?s_type .
     ?s <http://schema.org/name> ?s_label_g
}
GROUP BY ?s ?s_type


Anyone can help?

-- 
Lingsoft - 30 years of Leading Language Management

www.lingsoft.fi

Speech Applications - Language Management - Translation - Reader's and Writer's Tools - Text Tools - E-books and M-books

Mikael Pesonen
System Engineer

e-mail: mikael.pesonen@lingsoft.fi
Tel. +358 2 279 3300

Time zone: GMT+2

Helsinki Office
Eteläranta 10
FI-00130 Helsinki
FINLAND

Turku Office
Kauppiaskatu 5 A
FI-20100 Turku
FINLAND

Received on Thursday, 22 March 2018 13:34:38 UTC