Home
Categories
Dictionary
Download
Project Details
Changes Log
FAQ
License

Function expressions



The FunctionExpression represent function expressions used in SPARQL Requests.

Function expressions can appear in SELECT, ASK, BIND, FILTER, or COALESCE constructs.

Types of functions

There are two kinds of functions:
  • Built-in functions which are part of the SPARQL language
  • Custom functions which can be define in any namespace

Built-in functions

Built-in functions are created with one of the following constructors: The supported built-in functions are:
  • The BOUND function
  • The IF function
  • The floor function
  • The ceil function
  • The round function
  • The abs function
  • The concat function
  • The strlen function
  • The substr function
  • The str function
  • The isNumeric function
  • The isLiteral function
  • The isIRI function
  • The isURI function
  • The IRI function
  • The IN function
  • The NOT IN function
  • The sameTerm function
  • The COUNT function
  • The SUM function
  • The coalesce function
  • The replace function
  • The contains function
  • The MAX function
  • The MIN function
  • The regex function
  • The EXISTS function
  • The NOT EXISTS function
  • The DATATYPE function
  • The AVG function
  • The strstarts function
  • The strends function
  • The UCASE function
  • The LCASE function
  • The STRBEFORE function
  • The STRAFTER function
  • The YEAR function
  • The MONTH function
  • The DAY function
  • The HOURS function
  • The MINUTES function
  • The SECONDS function
  • The NOW function
  • The TIMEZONE function
  • The TZ function
  • The isBlank function

Custom functions

Custom functions are created with one of the following constructors:

Example

Built-in function

For example:
   SELECT ?country (COUNT(?city) AS ?TotalCity)
   WHERE {  
      ?city ge:isLocatedIn ?country . 
      ?city rdf:type ge:City .
   } 
   GROUP BY ?country

Custom function

For example:
   SELECT ?zone ?distance
   WHERE {
      ?zone rdf:type sitac:TaskZone .
      ?zone sitac:Latitude ?lat .
      ?zone sitac:Longitude ?lon .
      BIND (geo:distance(?lat, ?lon) as ?distance)
   }

See also


Categories: Requestcreation

Copyright 2025 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence