Home
Categories
Dictionary
Download
Project Details
Changes Log
FAQ
License

Expressions



The Expression is the interface for all expressions used in SPARQL Requests.

Types of expressions

The types of expressions can be:
  • The LiteralExpression class is used for literals
  • The VariableExpression class is used for expressions which only are a variable[1]
    For example for the ORDER BY ?var expression
  • The QualifiedNameExpression class is used for expressions which only encapsulate a qualified name
  • The ArithmeticExpression class is used for arithmetic expressions[2]
    For example for the BIND (?index * 2 as ?var) expression
  • The FunctionExpression class is used for functions expressions[3]
    For example for the SELECT ?zone (floor(?altitude) AS ?alt) expression
  • The ComparisonExpression class is used for comparison expressions[4]
    For example for the FILTER (?index < 5) expression

Function expressions

Main Article: Function expressions

Function expressions can appear in SELECT, BIND, FILTER, or COALESCE expressions. For example:
   SELECT ?country (COUNT(?city) AS ?TotalCity)
   WHERE {  
      ?city ge:isLocatedIn ?country . 
      ?city rdf:type ge:City .
   } 
   GROUP BY ?country

Expression variables

Used variables

The Expression.getVariables() return the names of all the variables used in the expression.

For example:
  • For the following expression:
    ?city + ?name
    
  • The method will return the city and name names

Produced variables

The Expression.getVariables() return the names of all the variables produced by in the expression.

For example:
  • For the following expression:
    ?city + ?name
    
  • The method will return the city and name names
And:
  • For the following expression:
    ?city > ?name
    
  • The method will return an empty set

Notes

  1. ^ For example for the ORDER BY ?var expression
  2. ^ For example for the BIND (?index * 2 as ?var) expression
  3. ^ For example for the SELECT ?zone (floor(?altitude) AS ?alt) expression
  4. ^ For example for the FILTER (?index < 5) expression

See also


Categories: Requestcreation

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