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

sttl.spin.query.fun.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 (strstarts(?ope, sp:), strafter(?ope, sp:), ?ope)
  "(" 
    if (bound(?d), "distinct ", "")
    
    st:call-template(sp:arg, ?in)
    
    if (! bound(?f) && ?ope in (sp:Count, sp:count, sp:COUNT), "*", "")
    
    if (bound(?s), concat(" ; separator = ", st:turtle(?s)), "") 
  ")"
}
where {
  ?in a ?ope 
  # ?ope matches any type, hence restrict this template to
  # SPIN blank nodes
  # otherwise c:John a foaf:Person would match this template
  filter(isBlank(?in))
  
  { ?in sp:arg1 ?f } union 
  { ?in sp:expression ?f } union 
  # function with no arg:
  { filter not exists { 
      ?in ?p ?v  filter(?p not in (sp:distinct, rdf:type )) }}
  
  optional { ?in sp:distinct ?d }
  optional { ?in sp:separator ?s }
  
      filter(
      ?ope not in (
        sp:undef,
	sp:lt, sp:gt, sp:le, sp:ge, sp:eq, sp:ne, 
	sp:add, sp:mul, sp:divide, sp:sub, 
	sp:in, sp:IN, sp:notIn, sp:Bind,
	sp:not, sp:and, sp:or)
      )       
}








© 2015 - 2025 Weber Informatics LLC | Privacy Policy