Janothan
Janothan

Reputation: 456

SPARQL Query Involving Chinese Characters

I am running the following query to obtain translations for the English word "father" on this public endpoint:

PREFIX dbnary: <http://kaiko.getalp.org/dbnary#>
select distinct ?l ?written where
{
dbnary-eng:father dbnary:describes ?le .
?t dbnary:isTranslationOf ?le .
?t dbnary:targetLanguage ?l .
?t dbnary:writtenForm ?written .
}

Among the strings returned, I can also find the Chinese translation "爸爸". When I try to reverse the query, I do not receive any result for Chinese words (it works for other languages):

PREFIX dbnary: <http://kaiko.getalp.org/dbnary#>
select distinct ?c where
{
?c dbnary:describes ?le .
?t dbnary:isTranslationOf ?le .
?t dbnary:targetLanguage ?l .
?t dbnary:writtenForm "爸爸" .
}

What am I doing wrong?

Upvotes: 1

Views: 89

Answers (1)

Janothan
Janothan

Reputation: 456

As Stanislav Kralin correctly points out, the reason for the query not working is the missing language annotation. The correct query formulation is as follows:

PREFIX dbnary: <http://kaiko.getalp.org/dbnary#>
select distinct ?c where
{
   ?c dbnary:describes ?le .
   ?t dbnary:isTranslationOf ?le .
   ?t dbnary:targetLanguage ?l .
   {?t dbnary:writtenForm "爸爸"@yue .}
   UNION {?t dbnary:writtenForm "爸爸"@cmn .}
}

Upvotes: 1

Related Questions