How to Query: Geospatial data

Obtain the bounding box of an arbitrary shape

prefix bif: <http://www.openlinksw.com/schemas/bif#>
prefix geo: <http://www.opengis.net/ont/geosparql#>
select ?original ("green" as ?originalColor) ?bbox {
  [ geo:asWKT ?original ].
  bind(replace(str(bif:st_get_bounding_box(?original)),
               'BOX\\((-?\\d*.\\d*)\\s(-?\\d*.\\d*),(-?\\d*.\\d*)\\s(-?\\d*.\\d*)\\)',
               'Polygon(($1 $2,$1 $4,$3 $4,$3 $2,$1 $2))') as ?bbox)
}
limit 1