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:

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 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

Creating an expression

Main Article: Creating an expression

There are two ways to create an expression:
  • Using the API to combine expressions
  • Parsing an expression from a String

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

Project Web Hosted by SourceForge.net Copyright 1999-2010 - Geeknet, Inc., All Rights Reserved About - Legal - Help