GraphStore`
GraphStore`

SPARQLEvaluation

SPARQLEvaluation["name"]

represents the built-in SPARQL function with the specified name, to be evaluated during SPARQL graph pattern matching.

SPARQLEvaluation[f]

represents the arbitrary function f.

Details and Options

  • SPARQLEvaluation[] can be used in filters, select expressions and aggregates.
  • Possible built-in SPARQL functions include:
  • "bound"tests whether a variable has a value
    "IF"an If statement
    "COALESCE"returns the first error-free term
    "EXISTS"tests whether a pattern exists
    "logical-or"the Or function
    "logical-and"the And function
    "RDFterm-equal"tests equality of terms with supported datatype
    "sameTerm"tests equality
    "IN"tests whether a term is a member of a list
  • Possible build-in SPARQL functions on RDF terms include:
  • "isIRI"tests whether a term is an IRI
    "isBlank"tests whether a term is an RDFBlankNode
    "isLiteral"tests whether a term is a literal
    "isNumeric"tests whether a termi is a valid number
    "str"returns the lexical form
    "lang"returns the language tag
    "datatype"returns the datatype
    "IRI"makes an IRI
    "BNODE"makes an RDFBlankNode
    "STRDT"makes an RDFLiteral
    "STRLANG"makes an RDFString
    "UUID"creates a UUID IRI
    "STRUUID"creates a UUID String
  • Possible build-in SPARQL functions on strings include:
  • "STRLEN"the StringLength function
    "SUBSTR"extracts a substring
    "UCASE"the ToUpperCase function
    "LCASE"the ToLowerCase function
    "STRSTARTS"tests whether a string start with another string
    "STRENDS"tests whether a string ends with another string
    "CONTAINS"tests whether a string contains another string
    "STRBEFORE"extraxts the substring occurring before another string
    "STRAFTER"extraxts the substring occurring after another string
    "ENCODE_FOR_URI"the URLEncode function
    "CONCAT"the StringJoin function
    "langMatches"tests whether the language of a string matches a language range
    "REGEX"tests whether a string matches a regular expression
    "REPLACE"replaces matching string parts
  • Possible build-in SPARQL functions on numbers include:
  • "abs"the Abs function
    "round"the Round function
    "ceil"the Ceiling function
    "floor"the Floor function
    "RAND"the RandomReal function
  • Possible build-in SPARQL functions on dates and times include:
  • "now"returns Now
    "year"returns the year
    "month"returns the month
    "day"returns the day of the month
    "hours"returns the hours
    "minutes"returns the minutes
    "seconds"returns the seconds
    "timezone"returns the timezone as duration
    "tz"returns the literal timezone value
  • Possible build-in SPARQL hash functions include:
  • "MD5"returns an MD5 hex string
    "SHA1"returns a SHA1 hex string
    "SHA256"returns a SHA256 hex string
    "SHA384"returns a SHA384 hex string
    "SHA512"returns a SHA512 hex string
  • Possible built-in SPARQL aggregate functions include:
  • "COUNT"counts the number of elements in a group
    "SUM"totals the values of a group
    "MIN"returns the minimum value in a group
    "MAX"returns the maximum value in a group
    "AVG"returns the averag of the values in a group
    "GROUP_CONCAT"joins String values of a group
    "SAMPLE"returns an arbitrary value from the group

Examples

open allclose all

Basic Examples  (1)

Person data:

Construct the name from first and last name:

Count the people for which the first name is known:

Possible Issues  (1)

General functions can't be exported as SPARQL string:

Use a SPARQL built-in function instead:

Certain WL functions are also supported:

Wolfram Research (2019), SPARQLEvaluation, Wolfram Language function, https://reference.wolfram.com/language/GraphStore/ref/SPARQLEvaluation.html.

Text

Wolfram Research (2019), SPARQLEvaluation, Wolfram Language function, https://reference.wolfram.com/language/GraphStore/ref/SPARQLEvaluation.html.

CMS

Wolfram Language. 2019. "SPARQLEvaluation." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/GraphStore/ref/SPARQLEvaluation.html.

APA

Wolfram Language. (2019). SPARQLEvaluation. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/GraphStore/ref/SPARQLEvaluation.html

BibTeX

@misc{reference.wolfram_2024_sparqlevaluation, author="Wolfram Research", title="{SPARQLEvaluation}", year="2019", howpublished="\url{https://reference.wolfram.com/language/GraphStore/ref/SPARQLEvaluation.html}", note=[Accessed: 12-October-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_sparqlevaluation, organization={Wolfram Research}, title={SPARQLEvaluation}, year={2019}, url={https://reference.wolfram.com/language/GraphStore/ref/SPARQLEvaluation.html}, note=[Accessed: 12-October-2024 ]}