SPARQL 1.1 Query Lanuage 17.4 Function Definitions の関数の定義を抜粋した備忘録
Functional Forms
bound
xsd:boolean BOUND (variable var)
IF
rdfTerm IF (expression1, expression2, expression3)
COALESCE
rdfTerm COALESCE(expression, ....)
NOT_EXISTS_and_EXISTS
xsd:boolean NOT EXISTS { pattern }
xsd:boolean EXISTS { pattern }
logical-or
xsd:boolean xsd:boolean left || xsd:boolean right
logical-and
xsd:boolean xsd:boolean left && xsd:boolean right
RDFterm-equal
xsd:boolean RDF term term1 = RDF term term2
sameTerm
xsd:boolean sameTerm (RDF term term1, RDF term term2)
IN
boolean rdfTerm IN (expression, ...)
NOT_IN
boolean rdfTerm NOT IN (expression, ...)
Functions on RDF Terms
isIRI
xsd:boolean isIRI (RDF term term)
xsd:boolean isURI (RDF term term)
isBlank
xsd:boolean isBlank (RDF term term)
isLiteral
xsd:boolean isLiteral (RDF term term)
isNumeric
xsd:boolean isNumeric (RDF term term)
str
simple literal STR (literal ltrl)
simple literal STR (IRI rsrc)
lang
simple literal LANG (literal ltrl)
datatype
iri DATATYPE (literal literal)
IRI
iri IRI(simple literal)
iri IRI(xsd:string)
iri IRI(iri)
iri URI(simple literal)
iri URI(xsd:string)
iri URI(iri)
BNODE
blank node BNODE()
blank node BNODE(simple literal)
blank node BNODE(xsd:string)
STRDT
literal STRDT(simple literal lexicalForm, IRI datatypeIRI)
STRLANG
literal STRLANG(simple literal lexicalForm, simple literal langTag)
UUID
iri UUID()
STRUUID
simple literal STRUUID()
Functions on Strings
STRLEN
xsd:integer STRLEN(string literal str)
SUBSTR
string literal SUBSTR(string literal source, xsd:integer startingLoc)
string literal SUBSTR(string literal source, xsd:integer startingLoc, xsd:integer length)
UCASE
string literal UCASE(string literal str)
LCASE
string literal LCASE(string literal str)
STRSTARTS
xsd:boolean STRSTARTS(string literal arg1, string literal arg2)
STRENDS
xsd:boolean STRENDS(string literal arg1, string literal arg2)
CONTAINS
xsd:boolean CONTAINS(string literal arg1, string literal arg2)
STRBEFORE
literal STRBEFORE(string literal arg1, string literal arg2)
STRAFTER
literal STRAFTER(string literal arg1, string literal arg2)
ENCODE_FOR_URI
simple literal ENCODE_FOR_URI(string literal ltrl)
CONCAT
string literal CONCAT(string literal ltrl1 ... string literal ltrln)
langMatches
xsd:boolean langMatches (simple literal language-tag, simple literal language-range)
REGEX
xsd:boolean REGEX (string literal text, simple literal pattern)
xsd:boolean REGEX (string literal text, simple literal pattern, simple literal flags)
REPLACE
string literal REPLACE (string literal arg, simple literal pattern, simple literal replacement )
string literal REPLACE (string literal arg, simple literal pattern, simple literal replacement, simple literal flags)
Functions on Numerics
abs
numeric ABS (numeric term)
round
numeric ROUND (numeric term)
ceil
numeric CEIL (numeric term)
floor
numeric FLOOR (numeric term)
RAND
xsd:double RAND ( )
Functions on Dates and Times
now
xsd:dateTime NOW ()
year
xsd:integer YEAR (xsd:dateTime arg)
month
xsd:integer MONTH (xsd:dateTime arg)
day
xsd:integer DAY (xsd:dateTime arg)
hours
xsd:integer HOURS (xsd:dateTime arg)
minutes
xsd:integer MINUTES (xsd:dateTime arg)
seconds
xsd:decimal SECONDS (xsd:dateTime arg)
timezone
xsd:dayTimeDuration TIMEZONE (xsd:dateTime arg)
tz
simple literal TZ (xsd:dateTime arg)
Hash Functions
MD5
simple literal MD5 (simple literal arg)
simple literal MD5 (xsd:string arg)
SHA1
simple literal SHA1 (simple literal arg)
simple literal SHA1 (xsd:string arg)
SHA256
simple literal SHA256 (simple literal arg)
simple literal SHA256 (xsd:string arg)
SHA384
simple literal SHA384 (simple literal arg)
simple literal SHA384 (xsd:string arg)
SHA512
simple literal SHA512 (simple literal arg)
simple literal SHA512 (xsd:string arg)