Library Functions¶
The Dydra SPARQL processor supports numerous native operators in addition to those defined by the SPARQL query language.
Many are drawn from the XPath function library while others are unique to the Dydra implementation.
In addition to functional operators it includes matching the processor extends the SPARQL
statement pattern unification process with multi-values predicates which add
capabilities such as text matching to SPARQL’s basic sameTerm
identification rules.
boolean (EXPRESSION)
¶
MACRO
date (EXPRESSION)
¶
MACRO
dateTime (EXPRESSION)
¶
MACRO
dayTimeDuration (EXPRESSION)
¶
MACRO
decimal (EXPRESSION)
¶
MACRO
double (EXPRESSION)
¶
MACRO
duration (EXPRESSION)
¶
MACRO
float (EXPRESSION)
¶
MACRO
gDay (EXPRESSION)
¶
MACRO
gMonth (EXPRESSION)
¶
MACRO
gMonthDay (EXPRESSION)
¶
MACRO
gYear (EXPRESSION)
¶
MACRO
gYearMonth (EXPRESSION)
¶
MACRO
integer (EXPRESSION)
¶
MACRO
string (EXPRESSION)
¶
MACRO
time (EXPRESSION)
¶
MACRO
yearMonthDuration (EXPRESSION)
¶
MACRO
abs (VALUE)
¶
FUNCTION
ceil (VALUE)
¶
FUNCTION
compare (TERM1 TERM2 &OPTIONAL COLLATION)
¶
FUNCTION
concat (&REST STRINGS)
¶
FUNCTION
contains (STRING1 STRING2 &OPTIONAL COLLATION)
¶
FUNCTION
dateTime (DATE TIME)
¶
FUNCTION
day-from-date (TERM)
¶
FUNCTION
day-from-dateTime (TERM)
¶
FUNCTION
days-from-duration (TERM)
¶
FUNCTION
ends-with (STRING1 STRING2 &OPTIONAL COLLATION)
¶
FUNCTION
floor (VALUE)
¶
FUNCTION
format-date (VALUE PICTURE &OPTIONAL LANGUAGE CALENDAR PLACE)
¶
FUNCTION
format-dateTime (VALUE PICTURE &OPTIONAL LANGUAGE CALENDAR PLACE)
¶
FUNCTION
format-duration (VALUE PICTURE &OPTIONAL LANGUAGE CALENDAR PLACE)
¶
FUNCTION
hours-from-dateTime (TERM)
¶
FUNCTION
hours-from-duration (TERM)
¶
FUNCTION
hours-from-time (TERM)
¶
FUNCTION
lower-case (STRING)
¶
FUNCTION
matches (TEXT PATTERN &OPTIONAL (FLAGS NIL))
¶
FUNCTION
minutes-from-dateTime (TERM)
¶
FUNCTION
minutes-from-duration (TERM)
¶
FUNCTION
minutes-from-time (TERM)
¶
FUNCTION
month-from-date (TERM)
¶
FUNCTION
month-from-dateTime (TERM)
¶
FUNCTION
months-from-duration (TERM)
¶
FUNCTION
not (VALUE)
¶
FUNCTION
replace (INPUT PATTERN REPLACEMENT &OPTIONAL (FLAGS NIL))
¶
FUNCTION
round (VALUE)
¶
FUNCTION
seconds-from-dateTime (TERM)
¶
FUNCTION
seconds-from-duration (TERM)
¶
FUNCTION
seconds-from-time (TERM)
¶
FUNCTION
starts-with (STRING1 STRING2 &OPTIONAL COLLATION)
¶
FUNCTION
string-length (STRING)
¶
FUNCTION
substring (VALUE START &OPTIONAL LENGTH)
¶
FUNCTION
substring-after (STRING SUBSTRING &OPTIONAL COLLATION)
¶
FUNCTION
substring-before (STRING SUBSTRING &OPTIONAL COLLATION)
¶
FUNCTION
timezone-from-date (TERM)
¶
FUNCTION
timezone-from-dateTime (TERM)
¶
FUNCTION
timezone-from-time (TERM)
¶
FUNCTION
upper-case (STRING)
¶
FUNCTION
year-from-date (TERM)
¶
FUNCTION
year-from-dateTime (TERM)
¶
FUNCTION
years-from-duration (TERM)
¶
FUNCTION
Extension Functions¶
In addition to the standard SPARQL 1.1 filter functions, Dydra also supports several useful extension functions. The examples employ the following namespace prefix bindings:
prefix |
IRI |
---|---|
rdf |
|
dydra |
http://dydra.com# |
dydra:account-name()
¶
This function returns the name of the current query’s owning account as a string value.
dydra:agent-id()
¶
This function returns the id af the authenticated agent of the current query as a string value. If the agent is not authenticated the value is unbound.
dydra:agent-location()
¶
This function returns the IP-address location af the authenticated agent of the current query as a string value. If the agent is not located the value is unbound.
dydra:query-uri()
¶
This function returns the IRI of the current query.
dydra:repository-name()
¶
This function returns the name of the current query’s target repository as a string value.
dydra:repository-uri()
¶
This function returns the URI of the current query’s target repository as a string value.
dydra:revision-uri()
¶
This function returns the IRI of the current query’s active revision.
dydra:revision-parent-uri()
¶
This function returns the IRI of the current query’s active revision’s parent.
dydra:transaction-signature()
¶
This function returns a digest signature of the query’s active revision. If none is available, it returns rdf:nil
dydra:transaction-uri()
¶
This function returns the IRI of the current query’s active transaction.
dydra:user-tag()
¶
This function returns the user query id tag associated with the current query as a string value.
rdf:Seq()
¶
This function facilitates creating RSS 1.0 feeds using
CONSTRUCT
queries.
Succesive invocations return monotonically increasing integer values.
dydra:term-number()
¶
Returns the internal term identifier for an RDF term. This value is stable within a given service.
Text Matching¶
In addition to the standard SPARQL sameTerm
rules which govern statement patter unification.
Dydra provides a mechanism for multi-values predicate pattern
to provide a text matching API.
The operation follws the precedent establish be Jena ARQ.
The prodicate is adopted from that namespace.
prefix |
IRI |
---|---|
arq |
<http://jena.hpl.hp.com/ARQ/property#> |
Where the predicate arq:textMatch
appears in a basic graph pattern, it permits
three parameter and three result bindings.
{ (?matchedText ?score) arq:textMatch (pattern langTag min max) }
The result elements are positional: the text result is required, while the score is optional. In a similar manner, the pattern is required while the language and constraints are optional. This permits SPARQL expression variants as follows:
SELECT ?matchedText WHERE {
( ?matchedText ) <http://jena.hpl.hp.com/ARQ/property#textMatch> ('printer:*') .
}
SELECT ?matchedText WHERE {
( ?matchedText ?score ) <http://jena.hpl.hp.com/ARQ/property#textMatch> ('printer:*') .
}
SELECT ?matchedText WHERE {
( ?matchedText ) <http://jena.hpl.hp.com/ARQ/property#textMatch> ('printer:*' 'EN') .
}
SELECT ?matchedText WHERE {
( ?matchedText ?score ) <http://jena.hpl.hp.com/ARQ/property#textMatch> ('printer:*' 'EN') .
}
SELECT ?matchedText WHERE {
( ?matchedText ) <http://jena.hpl.hp.com/ARQ/property#textMatch> ('printer:*' 'EN' 0) .
}
SELECT ?matchedText WHERE {
( ?matchedText ?score ) <http://jena.hpl.hp.com/ARQ/property#textMatch> ('printer:*' 'EN' 0) .
}
SELECT ?matchedText WHERE {
( ?matchedText ) <http://jena.hpl.hp.com/ARQ/property#textMatch> ('printer:*' 'EN' 0 10) .
}
SELECT ?matchedText WHERE {
( ?matchedText ?score ) <http://jena.hpl.hp.com/ARQ/property#textMatch> ('printer:*' 'EN' 0 10) .
}
The pattern syntax follows the POSTGRES pattern syntax.