#67 adding "OPTIONAL {} ." to query makes result empty


I have the following query, that returns a dozen or more results:

prefix sec: <http://www.rdfabout.com/rdf/schema/ussec/>
prefix ubsd: <http://rdf.ubs.com/owl/USSEC#>
select ?comp ?dt ?dir ?pn
where {
?i bbcr:rtg_sp ?sp .
?sp bbcr:rtg_sp_lt_fc_iss_cred_rtg_dt ?dt .
filter ( ?dt >= "2011-06-25"^^xsd:date and ?dt < "2011-07-01"^^xsd:date) .
# ---place1
?sp bbcr:rtg_sp_lt_fc_issuer_credit_dir ?dir .
# ---place2
filter ( ?dir = "DOWN" ) .
# ?i bbcr:long_comp_name ?comp .
# ?sc ubsd:hasIssuer ?i .
# ?rl sec:corporation ?sc .
# ?rl a sec:TenPercentOwnerRelation .
# ?ip sec:hasRelation ?rl .
# ?ip foaf:name ?pn

Adding a line "OPTIONAL {} ." (or an OPTIONAL with any contents) in various places makes the query return 0 lines:
- if the line is added at '---place1' or above, it causes no problems
- if the line is added at '---place2' or below (with additional triples blocks uncommented), 0 rows are produced
- if either FILTER line is commented out, results are produced as expected, regardless of presence of the OPTIONAL line

Additional troubleshooting hints welcome.


  • Ivan Mikhailov

    Ivan Mikhailov - 2011-09-21

    I can't reproduce this bug on release candidate of 6.1.4 version , but I can not treat the bug as closed because it might happen only for some specific execution plans. If the bug will persist with 6.1.4 then I'll need some subset of your data to debug.

  • Ivan Mikhailov

    Ivan Mikhailov - 2011-09-21
    • status: open --> open-works-for-me

Log in to post a comment.