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

  • 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"takes 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 mamber 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 all close all

Basic Examples  (1)

In[1]:=
Click for copyable input

Person data:

In[2]:=
Click for copyable input
In[3]:=
Click for copyable input

Construct the name from first and last name:

In[4]:=
Click for copyable input
Out[4]=

Count the people for which the first name is known:

In[5]:=
Click for copyable input
Out[5]=

Possible Issues  (1)