Unary Operator

Created on Feb. 23, 2013, 10:57 a.m. by Hevok & updated by Hevok on May 2, 2013, 5:20 p.m.

A Unary Operator is an Operation with only one Operand, i.e. a single input.

For the FILTER conditions there are several operators that can be used. There are some binary as well as Unary Operators. Unary Operators can be used in SPARQL for Constraints.

The exclamation mark ! means no, i.e. defines a Negation of a boolean type.

Plus + and minus - can be applied to some numeric values that will be interpreted as positive or as negative sign.

One can ask if a Variable is BOUND and the result will be a boolean, it is either bound which means it has a Value, i.e. the result is True, or it has not a Value, than the result is Zero or False. One can ask if an RDF term A is an URI or not and the result will be boolean True or False. Then one can ask if a RDF term is a Blank Term, if it is a Literal or if it is a string. One can also ask for a Language tag, i.e. which Language does a specific String or Literal has. Finally it is possible to ask for a DATATYPE that means which Datatype has a specific given Literal and the Datatype will be given back as the URI of the according Datatype.

Unary Operators that can be used in a FILTER expression:

Operator Type(A) Result Type
!A xsd:boolean xsd:boolean
+A numeric numeric
-a numeric numeric
BOUND(A) variable xsd:boolean
isURI(A) RDF term xsd:boolean
isBLANK(A) RDF term xsd:boolean
isLiteral(A) RDF term xsd:boolean
STR(A) Literal/URI simple Literal
LANG(A) Literal simple Literal
DATATYPE(A) Literal URI
grid06_150.jpg

Tags: query, operator, coding, programming, database
Categories: Tutorial, reST
Parent: SPARQL

Update entry (Admin) | See changes

Comment on This Data Unit