Lang query through RDF_BOX

Hello dear Virtuoso community,

Does anyone know how to list all languages, used in the system through RDF_BOX?

We tried the following query:

select DISTINCT rdf_box_lang (__ro2sq(O)) from RDF_QUAD;

But only got default language, 257.

Although we use the following languages in our database.

en 258
ru 259
all 260
de 261
262

This question is triggered by error:

GPF: Dkbox.c:1616 rb lang out of range

Maybe someone had the same?

https://github.com/openlink/virtuoso-opensource/issues/882

We tried to draw main tables here.

Here is our test database if someone could help (login: dba, password: dba).

Thank you!
Stas

Dear Virtuoso,

We might have found a heavy bug on our side.

Since we have introduced new language tag @all, we have changed this source code, that checks language tags.

create function DB.DBA.rdf_strlang_impl (in str varchar, in lang any)
{

lang := cast (lang as varchar);
if ((lang is null) or (regexp_match ('^(([a-z][a-z](-[A-Z][A-Z])?)|(x-[A-Za-z0-9]+))\044', lang) is null))
signal ('22007', 'Function rdf_strlang_impl needs a valid language ID as its second argument');
return DB.DBA.RDF_MAKE_LONG_OF_TYPEDSQLVAL (str, null, cast (lang as varchar));
}
;

We have removed regular expression checking.
It became:

create function DB.DBA.rdf_strlang_impl (in str varchar, in lang any)
{
    lang := cast (lang as varchar);
    if (lang is null)
        signal ('22007', 'Function rdf_strlang_impl needs a valid language ID as its second argument');

    return DB.DBA.RDF_MAKE_LONG_OF_TYPEDSQLVAL (str, null, cast (lang as varchar));
};

We took the initial file from Master branch.

And we made mistake here, because Master Branch contains Virtuoso 6 and not 7.

The 7th version has altogether different DB.DBA.rdf_strlang_impl procedure.
As follows:

create function DB.DBA.rdf_strlang_impl (in str varchar, in lang any)
{
  declare t integer;
  lang := cast (lang as varchar);
  if ((lang is null) or (regexp_match ('^(([a-z][a-z](-[A-Z][A-Z])?)|(x-[A-Za-z0-9]+))\044', lang) is null))
    signal ('22007', 'Function rdf_strlang_impl needs a valid language ID as its second argument');
  if (is_rdf_box (str))
    str := rdf_box_data (str, 1);
  t := __tag (str);
  if (__tag of nvarchar = t)
    str := charset_recode (str, '_WIDE_', 'UTF-8');
  else if (__tag of varchar <> t)
    {
      if (str is null)
        signal ('22007', 'Function rdf_strlang_impl needs a bound value as its first argument, not a NULL');
      str := cast (str as varchar);
    }
  return rdf_box (str, 257, DB.DBA.RDF_TWOBYTE_OF_LANGUAGE (lang), 0, 1);
}
;

So we started to use version 6 procedure with version 7 database.

If this is the cause for our crashes, we are really sorry for spending so much of your time helping us. :(((

Thank you and sorry again,
Stas

P.S.
I will ask further questions on github issue 882.

Hi Stas,

You would have seen my colleagues post in github issue 882, thus please continue the thread in the git issue, which given its nature is best pursued there …

Hi, Hugh.

Thank you for your help!