os:ValueFunction
Extracts a typed value via SPARQL SELECT with ?value binding. Useful in cases of dynamic values that depend on some context state.
Extends: os:SPARQLFunction
The ?value binding is cast to the datatype specified by os:datatype.
## This RDF resource could be used as an object in a triple to extract a value
[
os:datatype xsd:string ;
os:fromValue """
SELECT ?value WHERE {
?subject ex:id ?id .
BIND(STR(?id) AS ?value)
}
"""
]Properties
os:datatype (required, max 1)
The XSD datatype to cast the ?value result to.
ValueFunction must specify exactly one datatype for casting the extracted value.
Common values: xsd:string, xsd:integer, xsd:boolean, xsd:decimal, xsd:dateTime, etc.
os:fromValue (required, max 1)
SPARQL SELECT query that must bind ?value to a result.
ValueFunction must have exactly one fromValue query that binds ?value.
Query executes with access to bindings from the execution context. Result is cast to os:datatype.