virtuoso-opensource icon indicating copy to clipboard operation
virtuoso-opensource copied to clipboard

Incomplete results with VALUES in CONSTRUCT query

Open julianrojas87 opened this issue 2 years ago • 1 comments

Given the following graph:

@prefix ex: <http://example.org/> .
@prefix nav: <http://navigability.org/> .

ex:E1 a ex:Entity.

ex:E2 a ex:Entity.

ex:E3 a ex:Entity.

ex:E4 a ex:Entity.

ex:R1 a ex:Relation;
   ex:elementA ex:E1;
   ex:elementB ex:E2;
   ex:navigability nav:AB.

ex:R2 a ex:Relation;
   ex:elementA ex:E2;
   ex:elementB ex:E3;
   ex:navigability nav:Both.

ex:R3 a ex:Relation;
   ex:elementA ex:E3;
   ex:elementB ex:E4;
   ex:navigability nav:BA.

ex:R4 a ex:Relation;
   ex:elementA ex:E4;
   ex:elementB ex:E1;
   ex:navigability nav:None.

This query gives incomplete results on Virtuoso version 07.20.3237 (f3d88f16b) on Linux (x86_64-ubuntu_bionic-linux-gnu) Single Server Edition:

PREFIX ex: <http://example.org/>
PREFIX nav: <http://navigability.org/>
CONSTRUCT {
   ?e1 ex:connectedTo ?e2.
} WHERE {
   VALUES  ?navAB { nav:AB nav:Both }
   VALUES  ?navBA { nav:BA nav:Both }
   
   {
      ?r1 a ex:Relation;
         ex:elementA ?e1;
         ex:elementB ?e2;
         ex:navigability ?navAB.
   }
   UNION
   {
      ?r2 a ex:Relation;
         ex:elementA ?e2;
         ex:elementB ?e1;
         ex:navigability ?navBA.
   }
}

The expected results should be:

<http://example.org/E4>  <http://example.org/connectedTo>  <http://example.org/E3> .
<http://example.org/E2>  <http://example.org/connectedTo>  <http://example.org/E3> .
<http://example.org/E3>  <http://example.org/connectedTo>  <http://example.org/E2> .
<http://example.org/E1>  <http://example.org/connectedTo>  <http://example.org/E2> .

But instead it gives:

<http://example.org/E1>  <http://example.org/connectedTo>  <http://example.org/E2> .
<http://example.org/E2>  <http://example.org/connectedTo>  <http://example.org/E3> .

The results seem to be only binding for the first VALUES list.

The same scenario is evaluated correctly in Virtuoso version 08.03.3328 (348f8243fe) on Linux (x86_64-ubuntu_focal-linux-gnu-glibc2.31) Single Server Edition.

julianrojas87 avatar Aug 22 '23 21:08 julianrojas87

@julianrojas87 We have been able to recreate this issue which has been reported to development to look into and fix ...

HughWilliams avatar Aug 23 '23 12:08 HughWilliams