There are some triples that cannot be searched if a variable that appears in the OPTIONAL clause is specified in the SELECT. The following isql run shows zero results when the variable ?organismCommonName is specified in the SELECT, but one result when it is not specified in the SELECT.
SQL> SPARQL
Type the rest of statement, end with a semicolon (;)> DEFINE input:inference "trans"
Type the rest of statement, end with a semicolon (;)> PREFIX up: <http://purl.uniprot.org/core/>
Type the rest of statement, end with a semicolon (;)> SELECT DISTINCT ?uniprot ?organism ?organismCommonName
Type the rest of statement, end with a semicolon (;)> WHERE {
Type the rest of statement, end with a semicolon (;)> VALUES ?uniprot { <http://purl.uniprot.org/uniprot/Q0P7R8> }
Type the rest of statement, end with a semicolon (;)> ?uniprot up:organism ?organism .
Type the rest of statement, end with a semicolon (;)> OPTIONAL {
Type the rest of statement, end with a semicolon (;)> ?organism up:commonName ?organismCommonName .
Type the rest of statement, end with a semicolon (;)> }
Type the rest of statement, end with a semicolon (;)> }
Type the rest of statement, end with a semicolon (;)> ;
uniprot organism organismCommonName
VARCHAR LONG VARCHAR LONG VARCHAR
_______________________________________________________________________________
0 Rows. -- 1 msec.
SQL>
SQL> SPARQL
Type the rest of statement, end with a semicolon (;)> DEFINE input:inference "trans"
Type the rest of statement, end with a semicolon (;)> PREFIX up: <http://purl.uniprot.org/core/>
Type the rest of statement, end with a semicolon (;)> SELECT DISTINCT ?uniprot ?organism
Type the rest of statement, end with a semicolon (;)> WHERE {
Type the rest of statement, end with a semicolon (;)> VALUES ?uniprot { <http://purl.uniprot.org/uniprot/Q0P7R8> }
Type the rest of statement, end with a semicolon (;)> ?uniprot up:organism ?organism .
Type the rest of statement, end with a semicolon (;)> OPTIONAL {
Type the rest of statement, end with a semicolon (;)> ?organism up:commonName ?organismCommonName .
Type the rest of statement, end with a semicolon (;)> }
Type the rest of statement, end with a semicolon (;)> }
Type the rest of statement, end with a semicolon (;)> ;
uniprot organism
VARCHAR LONG VARCHAR
_______________________________________________________________________________
http://purl.uniprot.org/uniprot/Q0P7R8 http://purl.uniprot.org/taxonomy/192222
1 Rows. -- 1 msec.
SQL>
What can I do to make sure these cases are included in the results?