Skip to content

Commit

Permalink
Fix search query when subject age is repeated (#5178)
Browse files Browse the repository at this point in the history
Co-authored-by: Simon Dumas <simon.dumas@epfl.ch>
  • Loading branch information
imsdu and Simon Dumas authored Oct 15, 2024
1 parent 2895766 commit b44315f
Showing 1 changed file with 15 additions and 13 deletions.
28 changes: 15 additions & 13 deletions tests/docker/config/search/construct-query.sparql
Original file line number Diff line number Diff line change
Expand Up @@ -511,19 +511,21 @@ CONSTRUCT {

# Subject
OPTIONAL {
?id nsg:subject / nsg:age ?age .
OPTIONAL { ?age schema:value ?subjectAgeValue . } .
OPTIONAL { ?age schema:minValue ?subjectAgeMinValue . } .
OPTIONAL { ?age schema:maxValue ?subjectAgeMaxValue . } .
?age schema:unitCode ?subjectAgeUnit .
?age nsg:period ?subjectAgePeriod .
BIND(
IF(
BOUND(?subjectAgeValue),
CONCAT(STR(?subjectAgeValue), " ", STR(?subjectAgeUnit), " ", STR(?subjectAgePeriod)),
CONCAT(STR(?subjectAgeMinValue), " to ", STR(?subjectAgeMaxValue), " ", STR(?subjectAgeUnit), " ", STR(?subjectAgePeriod))
) as ?subjectAgeLabel ) .
} .
GRAPH ?id {
BIND(BNODE(CONCAT(STR(?id), '/age')) as ?age ) .
OPTIONAL { ?id nsg:subject / nsg:age / schema:value ?subjectAgeValue . } .
OPTIONAL { ?id nsg:subject / nsg:age / schema:minValue ?subjectAgeMinValue . } .
OPTIONAL { ?id nsg:subject / nsg:age / schema:maxValue ?subjectAgeMaxValue . } .
?id nsg:subject / nsg:age / schema:unitCode ?subjectAgeUnit .
?id nsg:subject / nsg:age / nsg:period ?subjectAgePeriod .
BIND(
IF(
BOUND(?subjectAgeValue),
CONCAT(STR(?subjectAgeValue), " ", STR(?subjectAgeUnit), " ", STR(?subjectAgePeriod)),
CONCAT(STR(?subjectAgeMinValue), " to ", STR(?subjectAgeMaxValue), " ", STR(?subjectAgeUnit), " ", STR(?subjectAgePeriod))
) as ?subjectAgeLabel ) .
}
} .

OPTIONAL {
?id nsg:subject / schema:weight ?weight .
Expand Down

0 comments on commit b44315f

Please sign in to comment.