Prefixes on subqueries

Stardog does not consider valid prefixes on subqueries. Is this a bug?

For example, the query below are not syntactical correct by stardog.

PREFIX realestate: http://geophy.io/ontologies/realestate#
PREFIX wgs84: http://www.w3.org/2003/01/geo/wgs84_pos#
PREFIX system: http://geophy.io/ontologies/system#
PREFIX f: geophy:function:
PREFIX meta: http://geophy.io/ontologies/rank/meta#
select *
WHERE

    { PREFIX  realestate: <http://geophy.io/ontologies/realestate#>
      PREFIX  wgs84: <http://www.w3.org/2003/01/geo/wgs84_pos#>
      PREFIX  system: <http://geophy.io/ontologies/system#>
      PREFIX  f:    <geophy:function:>
      PREFIX  meta: <http://geophy.io/ontologies/rank/meta#>
      
      SELECT  ?functional_area ?purpose ?renovation_year ?construction_year
      WHERE
        { 
          VALUES ?building {   <http://geophy.io/buildings/55881>     }
          ?building  realestate:construction_year  ?con_year
          
        }   

}


When we remove the prefixes, it is valid.

PREFIX realestate: http://geophy.io/ontologies/realestate#
PREFIX wgs84: http://www.w3.org/2003/01/geo/wgs84_pos#
PREFIX system: http://geophy.io/ontologies/system#
PREFIX f: geophy:function:
PREFIX meta: http://geophy.io/ontologies/rank/meta#
select *
WHERE

    {  
      
      SELECT  ?functional_area ?purpose ?renovation_year ?construction_year
      WHERE
        { 
          VALUES ?building {   <http://geophy.io/buildings/55881>     }
          ?building  realestate:construction_year  ?con_year
          
        }

}

The issue occurs when using Jena. If I send the second query, jena rewrites it adding prefixes to the subquery. Then stardog do not accept it.

Are prefixes on subqueries syntactically valid by the sparql specification?

Best,
Samur

No, they are not: https://www.w3.org/TR/sparql11-query/#rSubSelect

Best,
Pavel

1 Like