Multiple OPTIONAL blocks supported

5 views
Skip to first unread message

bgad...@intec.ugent.be

unread,
Mar 12, 2014, 5:43:16 AM3/12/14
to sta...@clarkparsia.com
Hi,

I've created this SPARQL query:

PREFIX : <http://www.ugent.be/chest#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX temp: <http://swrl.stanford.edu/ontologies/built-ins/3.3/temporal.owl#>
select ?admid ?infid ?pao2val ?tempval
where {
        ?inf rdf:type :RespiratoryInfection .
        ?inf :hasInfectionStart ?infstart .
        ?inf :hasInfectionEnd ?infend .
        ?inf :hasInfectionId ?infid .
        ?inf :isInfectionOf ?adm .
        ?adm a :PatientAdmission .
        ?adm :hasAdmissionId ?admid .
        ?inf :isTreatedBy ?treatment .
        ?treatment rdf:type :AntibioticTreatment .
        ?treatment :hasGenericName ?gname .
        OPTIONAL {
                ?temp :isBodyTemperatureOf ?adm .
                ?temp temp:hasTime ?temptime .
                ?temp a :NoFever .
                ?temp :hasDoubleValue ?tempval.
                FILTER (
                        ?temptime >= ?infstart && ?temptime <= ?infend
                )
        } .
        OPTIONAL{
                ?pao2 :isPao2fio2Of ?adm .
                ?pao2 temp:hasTime ?pao2time .
                ?pao2 :hasDoubleValue ?pao2val .
                ?pao2 a :HighPao2fio2 .
                FILTER(
                        ?pao2time <= ?infend &&
                        ?pao2time >= ?infstart
                )
        } .
}

When it is executed I get results from the tempval optional part.

If I change the order of the Optional parts then I only get results for the pao2val part.

Does stardog support multiple OPTIONAL parts?

I've cross checked the query and I do get results for the same data that's not in the OPTIONAL parts. (so for the same infection and patient admission).

HighPao2fio2 and NoFever are both assigned using a user defined rule.

bgad...@intec.ugent.be

unread,
Mar 12, 2014, 12:23:19 PM3/12/14
to sta...@clarkparsia.com
I've also tested this on Stardog 2.1.1. Now It seems to work so I guess there was a bug in stardog 2.0.3.

Op woensdag 12 maart 2014 10:43:16 UTC+1 schreef bgad...@intec.ugent.be:
Reply all
Reply to author
Forward
0 new messages