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.