openlink / virtuoso-opensource

Virtuoso is a high-performance and scalable Multi-Model RDBMS, Data Integration Middleware, Linked Data Deployment, and HTTP Application Server Platform
https://vos.openlinksw.com
Other
867 stars 210 forks source link

Internal error: ssg_print_box_as_sql_atom (): bad mode #976

Open galgonek opened 3 years ago

galgonek commented 3 years ago

While working on a study comparing different approaches to query the neXtProt dataset, I have observed that Virtuoso returns wrong results in some cases.

If I create the table —

create table nextprot.entry_bases
(
    id                  varchar not null,
    existence           varchar not null,
    primary key(id)
);

— and define the mapping —

xml_set_ns_decl('', 'http://nextprot.org/rdf#', 2);
xml_set_ns_decl('iri', 'http://bioinfo.iocb.cz/rdf/quad-storage/linked-data-view/iri-class/nextprot#', 2);

sparql create iri class iri:entry "http://nextprot.org/rdf/entry/%U"(in id varchar not null) option (bijection).;
sparql create iri class iri:schema "http://nextprot.org/rdf#%U"(in id varchar not null) option (bijection).;

sparql create quad storage virtrdf:NeXtProtQuadStorage
    from DB.nextprot.entry_bases as entry_bases
{
  create virtrdf:nextprot as graph iri ("http://nextprot.org/rdf")
  {
    iri:entry(entry_bases.id)
      :existence iri:schema(entry_bases.existence).
  }
};

— then the SPARQL query —

sparql
define input:storage virtrdf:NeXtProtQuadStorage
select * where {
  ?entry :existence ?level.
  filter (?level != :Evidence_at_protein_level).
};

— returns the error —

SQ074: Line 6: SP031: SPARQL compiler: Internal error: ssg_print_box_as_sql_atom (): bad mode

As a workaround, the iri() function can be used, and the following query works as expected:

sparql
define input:storage virtrdf:NeXtProtQuadStorage
select * where {
  ?entry :existence ?level.
  filter (iri(?level) != :Evidence_at_protein_level).
};
openlink commented 3 years ago

Our development team will review this issue and report back as soon as posible.