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

Variable in T_IN list and corresponding variable in T_OUT get values from columns that are too different #975

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 tables —

create table nextprot.isoform_bases
(
    id                          varchar not null,
    entry                       varchar not null,
    primary key(id)
);

create table nextprot.isoform_cellular_components
(
    isoform     varchar not null,
    annotation  varchar not null,
    primary key(isoform, annotation)
);

— 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:isoform "http://nextprot.org/rdf/isoform/%U"(in id varchar not null) option (bijection).;
sparql create iri class iri:annotation "http://nextprot.org/rdf/annotation/%U"(in id varchar not null) option (bijection).;

sparql create quad storage virtrdf:NeXtProtQuadStorage
    from DB.nextprot.isoform_bases as isoform_bases
    from DB.nextprot.isoform_cellular_components as isoform_cellular_components
{
  create virtrdf:nextprot as graph iri ("http://nextprot.org/rdf")
  {
    iri:entry(isoform_bases.entry)
      :isoform iri:isoform(isoform_bases.id).

    iri:isoform(isoform_cellular_components.isoform)
      :cellularComponent iri:annotation(isoform_cellular_components.annotation).
  }
};

— then the SPARQL query —

sparql
define input:storage virtrdf:NeXtProtQuadStorage
select * where {
  ?interactant :isoform? / :cellularComponent ?loc .
};

— returns the error —

SQ074: Line 5: SP031: SPARQL compiler: Variable ?_::trans_subj_4_1 in T_IN list and corresponding variable ?_::trans_obj_4_2 in T_OUT get values from columns that are too different

openlink commented 3 years ago

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