New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UUID() and STRUUID() evaluated once per query rather than once per binding #515

Open
jindrichmynarz opened this Issue Dec 30, 2015 · 17 comments

Comments

Projects
None yet
9 participants
@jindrichmynarz

jindrichmynarz commented Dec 30, 2015

If you execute a query that uses UUID() or STRUUID() the same UUID is generated for each binding. For example (tested on Virtuoso 07.20.3215):

SELECT ?s ?p ?o (STRUUID() AS ?uuid)
WHERE {
  ?s ?p ?o .
}
LIMIT 10

This leads me to believe that the UUID functions are evaluated only once per query execution rather than once per each query binding. The SPARQL specification says that "Each call of UUID() returns a different UUID." It seems that Virtuoso violates that. Moreover, I think previous versions of Virtuoso implemented this correctly, so it may be a regression.

@HughWilliams

This comment has been minimized.

Show comment
Hide comment
@HughWilliams

HughWilliams Dec 30, 2015

Collaborator

@jindrichmynarz: Works fine for me with each execution returning a different UUID ...

SQL> SPARQL SELECT ?s ?p ?o (STRUUID() AS ?uuid) WHERE {   ?s ?p ?o . } LIMIT 2; 
s                                                                                 p                                                                                 o                                                                                 uuid
LONG VARCHAR                                                                      LONG VARCHAR                                                                      LONG VARCHAR                                                                      VARCHAR
_______________________________________________________________________________

http://www.openlinksw.com/virtrdf-data-formats#default-iid                        http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat                           8CE00A58-AF0D-11E5-9AD7-C8463BEB0D19
http://www.openlinksw.com/virtrdf-data-formats#default-iid-nullable               http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat                           8CE00A58-AF0D-11E5-9AD7-C8463BEB0D19

2 Rows. -- 3 msec.
SQL> SQL> SPARQL SELECT ?s ?p ?o (STRUUID() AS ?uuid) WHERE {   ?s ?p ?o . } LIMIT 2;
s                                                                                 p                                                                                 o                                                                                 uuid
LONG VARCHAR                                                                      LONG VARCHAR                                                                      LONG VARCHAR                                                                      VARCHAR
_______________________________________________________________________________

http://www.openlinksw.com/virtrdf-data-formats#default-iid                        http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat                           97009E76-AF0D-11E5-9AD7-C8463BEB0D19
http://www.openlinksw.com/virtrdf-data-formats#default-iid-nullable               http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat                           97009E76-AF0D-11E5-9AD7-C8463BEB0D19

2 Rows. -- 1 msec.
SQL> SPARQL SELECT ?s ?p ?o (STRUUID() AS ?uuid) WHERE {   ?s ?p ?o . } LIMIT 2;
s                                                                                 p                                                                                 o                                                                                 uuid
LONG VARCHAR                                                                      LONG VARCHAR                                                                      LONG VARCHAR                                                                      VARCHAR
_______________________________________________________________________________

http://www.openlinksw.com/virtrdf-data-formats#default-iid                        http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat                           9BEF4874-AF0D-11E5-9AD7-C8463BEB0D19
http://www.openlinksw.com/virtrdf-data-formats#default-iid-nullable               http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat                           9BEF4874-AF0D-11E5-9AD7-C8463BEB0D19

2 Rows. -- 0 msec.
SQL> status('');
REPORT
VARCHAR
_______________________________________________________________________________

OpenLink Virtuoso  Server
Version 07.20.3215-pthreads for Darwin as of Dec 30 2015 
Started on: 2015-12-30 15:35 GMT+0
Collaborator

HughWilliams commented Dec 30, 2015

@jindrichmynarz: Works fine for me with each execution returning a different UUID ...

SQL> SPARQL SELECT ?s ?p ?o (STRUUID() AS ?uuid) WHERE {   ?s ?p ?o . } LIMIT 2; 
s                                                                                 p                                                                                 o                                                                                 uuid
LONG VARCHAR                                                                      LONG VARCHAR                                                                      LONG VARCHAR                                                                      VARCHAR
_______________________________________________________________________________

http://www.openlinksw.com/virtrdf-data-formats#default-iid                        http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat                           8CE00A58-AF0D-11E5-9AD7-C8463BEB0D19
http://www.openlinksw.com/virtrdf-data-formats#default-iid-nullable               http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat                           8CE00A58-AF0D-11E5-9AD7-C8463BEB0D19

2 Rows. -- 3 msec.
SQL> SQL> SPARQL SELECT ?s ?p ?o (STRUUID() AS ?uuid) WHERE {   ?s ?p ?o . } LIMIT 2;
s                                                                                 p                                                                                 o                                                                                 uuid
LONG VARCHAR                                                                      LONG VARCHAR                                                                      LONG VARCHAR                                                                      VARCHAR
_______________________________________________________________________________

http://www.openlinksw.com/virtrdf-data-formats#default-iid                        http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat                           97009E76-AF0D-11E5-9AD7-C8463BEB0D19
http://www.openlinksw.com/virtrdf-data-formats#default-iid-nullable               http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat                           97009E76-AF0D-11E5-9AD7-C8463BEB0D19

2 Rows. -- 1 msec.
SQL> SPARQL SELECT ?s ?p ?o (STRUUID() AS ?uuid) WHERE {   ?s ?p ?o . } LIMIT 2;
s                                                                                 p                                                                                 o                                                                                 uuid
LONG VARCHAR                                                                      LONG VARCHAR                                                                      LONG VARCHAR                                                                      VARCHAR
_______________________________________________________________________________

http://www.openlinksw.com/virtrdf-data-formats#default-iid                        http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat                           9BEF4874-AF0D-11E5-9AD7-C8463BEB0D19
http://www.openlinksw.com/virtrdf-data-formats#default-iid-nullable               http://www.w3.org/1999/02/22-rdf-syntax-ns#type                                   http://www.openlinksw.com/schemas/virtrdf#QuadMapFormat                           9BEF4874-AF0D-11E5-9AD7-C8463BEB0D19

2 Rows. -- 0 msec.
SQL> status('');
REPORT
VARCHAR
_______________________________________________________________________________

OpenLink Virtuoso  Server
Version 07.20.3215-pthreads for Darwin as of Dec 30 2015 
Started on: 2015-12-30 15:35 GMT+0
@jindrichmynarz

This comment has been minimized.

Show comment
Hide comment
@jindrichmynarz

jindrichmynarz Dec 30, 2015

Yes, it returns a different UUID per each query execution. The issue is that the generated UUIDs are the same for each binding in the result set.

jindrichmynarz commented Dec 30, 2015

Yes, it returns a different UUID per each query execution. The issue is that the generated UUIDs are the same for each binding in the result set.

@jindrichmynarz

This comment has been minimized.

Show comment
Hide comment
@jindrichmynarz

jindrichmynarz Dec 30, 2015

For example, try this query:

SELECT (STRUUID() AS ?uuid)
WHERE { VALUES ?line { 1 2 3 4 5 } }

Using Virtuoso, all 5 generated UUIDs are the same. Using Apache Jena Fuseki, each UUID is distinct (see here).

jindrichmynarz commented Dec 30, 2015

For example, try this query:

SELECT (STRUUID() AS ?uuid)
WHERE { VALUES ?line { 1 2 3 4 5 } }

Using Virtuoso, all 5 generated UUIDs are the same. Using Apache Jena Fuseki, each UUID is distinct (see here).

@HughWilliams

This comment has been minimized.

Show comment
Hide comment
@HughWilliams

HughWilliams Dec 30, 2015

Collaborator

@jindrichmynarz: OK, I miss read your description, I can see the problem now and have reported to development ...

Collaborator

HughWilliams commented Dec 30, 2015

@jindrichmynarz: OK, I miss read your description, I can see the problem now and have reported to development ...

@Polymathronic

This comment has been minimized.

Show comment
Hide comment
@Polymathronic

Polymathronic Jan 19, 2016

+1. Any updates?

Polymathronic commented Jan 19, 2016

+1. Any updates?

@openlink

This comment has been minimized.

Show comment
Hide comment
@openlink

openlink Jan 19, 2016

Owner

Development is working on a fix which will hopefully be committed soon.

Owner

openlink commented Jan 19, 2016

Development is working on a fix which will hopefully be committed soon.

@jindrichmynarz

This comment has been minimized.

Show comment
Hide comment
@jindrichmynarz

jindrichmynarz Apr 7, 2016

Is there a progress on this issue?

jindrichmynarz commented Apr 7, 2016

Is there a progress on this issue?

@jent-org

This comment has been minimized.

Show comment
Hide comment
@jent-org

jent-org Apr 29, 2016

The same issue is with bif:next_sequence function

jent-org commented Apr 29, 2016

The same issue is with bif:next_sequence function

@Polymathronic

This comment has been minimized.

Show comment
Hide comment
@Polymathronic

Polymathronic Aug 24, 2016

Has this been resolved?

Polymathronic commented Aug 24, 2016

Has this been resolved?

@HughWilliams

This comment has been minimized.

Show comment
Hide comment
@HughWilliams

HughWilliams Aug 26, 2016

Collaborator

This issue is still to be resolved ...

Collaborator

HughWilliams commented Aug 26, 2016

This issue is still to be resolved ...

@jindrichmynarz

This comment has been minimized.

Show comment
Hide comment
@jindrichmynarz

jindrichmynarz Nov 1, 2016

This is still an issue in 377438a.

jindrichmynarz commented Nov 1, 2016

This is still an issue in 377438a.

@yyz1989

This comment has been minimized.

Show comment
Hide comment
@yyz1989

yyz1989 Feb 8, 2017

is it still open?

yyz1989 commented Feb 8, 2017

is it still open?

@jindrichmynarz

This comment has been minimized.

Show comment
Hide comment
@jindrichmynarz

jindrichmynarz Apr 17, 2017

Still an issue in 07.20.3217.

jindrichmynarz commented Apr 17, 2017

Still an issue in 07.20.3217.

@HughWilliams

This comment has been minimized.

Show comment
Hide comment
@HughWilliams

HughWilliams Apr 22, 2017

Collaborator

Chased development of update on fix for this issue ...

Collaborator

HughWilliams commented Apr 22, 2017

Chased development of update on fix for this issue ...

@jakubklimek

This comment has been minimized.

Show comment
Hide comment
@jakubklimek

jakubklimek commented Sep 8, 2017

Any news?

@j-pb

This comment has been minimized.

Show comment
Hide comment
@j-pb

j-pb Nov 6, 2017

Any update?

j-pb commented Nov 6, 2017

Any update?

@boutros

This comment has been minimized.

Show comment
Hide comment
@boutros

boutros Jul 5, 2018

Would be great to have this fixed. Any pointers to where to look in the code if I where to have a go at it?

boutros commented Jul 5, 2018

Would be great to have this fixed. Any pointers to where to look in the code if I where to have a go at it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment