Just tried to move the VALUES clause of the second query inside the WHERE 
clause and now it gives the same result as the first query. I am using the 
Query# setValuesDataBlock(...) method to set the values programmatically. Can I 
control where this method puts the VALUES clause?

Regards, Barry

-----Original Message-----
From: Nouwt, B. (Barry) <barry.no...@tno.nl.INVALID> 
Sent: vrijdag 6 mei 2022 17:26
To: users@jena.apache.org
Subject: RE: SPARQL question

I also tried the two queries below using Virtuoso instead of Apache Jena, but 
Virtuoso behaves the same with the first query, but gives the following parse 
error with the second query:

Virtuoso S0022 Error SQ200: No column sat.

-----Original Message-----
From: Nouwt, B. (Barry) <barry.no...@tno.nl.INVALID> 
Sent: vrijdag 6 mei 2022 17:21
To: users@jena.apache.org
Subject: RE: SPARQL question

Just found the following Stack Overflow question which looks related: 
https://stackoverflow.com/questions/56891312/difference-in-performance-between-using-values-keyword-and-using-directly-the-ur

Although they talk mostly about the difference in performance between the two 
approaches and not about the difference in semantics.


-----Original Message-----
From: Nouwt, B. (Barry) <barry.no...@tno.nl.INVALID> 
Sent: vrijdag 6 mei 2022 17:16
To: users@jena.apache.org
Subject: SPARQL question

Hi everyone, two SPARQL queries which I assumed are the same give different 
results in Apache Jena. The two queries are:

SELECT * WHERE {
<https://www.tno.nl/kb1/meta/knowledgeinteractions/react/changed/act/requirement>
 a  ?someClass FILTER NOT EXISTS { 
<https://www.tno.nl/kb2/meta/knowledgeinteractions/post/new/act/satisfaction> a 
 ?someClass } }

SELECT * WHERE
{
?req a  ?someClass
FILTER NOT EXISTS {
?sat a  ?someClass
}
}
VALUES (?req ?sat) {
(<https://www.tno.nl/kb1/meta/knowledgeinteractions/react/changed/act/requirement>
 <https://www.tno.nl/kb2/meta/knowledgeinteractions/post/new/act/satisfaction>)
}

Note that the queries are basically the same, but the second query uses the 
VALUES keyword to bind the ?req and ?sat variables, while the first query 
replaces the actual ?req and ?sat variables occurrences instead.

Does anyone know what I am missing?

Best regards,

Barry
This message may contain information that is not intended for you. If you are 
not the addressee or if this message was sent to you by mistake, you are 
requested to inform the sender and delete the message. TNO accepts no liability 
for the content of this e-mail, for the manner in which you use it and for 
damage of any kind resulting from the risks inherent to the electronic 
transmission of messages.

Reply via email to