All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sttl.spin.query.select.rq Maven / Gradle / Ivy

Go to download

Corese is a Semantic Web Factory (triple store and SPARQL endpoint) implementing RDF, RDFS, SPARQL 1.1 Query and Update.

There is a newer version: 4.6.1
Show newest version
#
# SPARQL-based RDF AST Pretty-printer
# Olivier Corby, Wimmics Inria I3S, 2013
#
prefix sp:       .

template {
  if (! (exists {?x ?p ?in}), st:namespace(), "") 
  st:kw("select") " " 
  if (bound(?t), st:kw("distinct "), "")
  if (bound(?r), "reduced ", "")
  if (bound(?select), 
    st:call-template(sp:list, ?select), 
    "*")  
  
  st:nl()
  st:call-template(sp:from, ?in)
  st:call-template(sp:named, ?in)
  
  st:kw("where") " {" 
      box { 
	st:call-template(sp:listnl, ?where) 
      } 
  "}" 
  
  st:nl()
  
  ?group
  ?order
  ?having 
  
  if (bound(?l), 
  concat(st:kw("limit"),  " ", ?l, st:nl()), "")  
  if (bound(?o), 
  concat(st:kw("offset"), " ", ?o, st:nl()), "") 
  
  st:call-template(sp:values, ?in)
}
where {
  ?in a sp:Select
  ?in sp:where ?where
  
  optional { ?in sp:resultVariables ?select }
  optional { ?in sp:distinct ?t filter(?t = true) }    
  optional { ?in sp:reduced  ?r filter(?r = true) }  

  optional { ?in sp:groupBy  ?group }
  optional { ?in sp:orderBy  ?order }
  optional { ?in sp:having   ?having }
  optional { ?in sp:limit  ?l }
  optional { ?in sp:offset ?o }
}







© 2015 - 2025 Weber Informatics LLC | Privacy Policy