Property Functions

Invoking actions as SPARQL property functions.

In Poliglot's SPARQL engine, actions can be invoked directly within scripts using property function syntax. This is how script handlers call other actions as sub-operations.

Syntax

?result <actionUri> (?subject <prop1> <value1> <prop2> <value2>) .

The left-hand side is the result variable. The predicate is the action URI. The right-hand side is a list containing the subject (optional) followed by payload property-value pairs. In practice, all URIs use prefixes:

PREFIX tasks: <https://example.org/spec/tasks#>

?result tasks:GetTask (?task) .

Subject-Only

When the action requires a subject and takes no payload:

PREFIX tasks: <https://example.org/spec/tasks#>

?result tasks:GetTask (?task) .

?task is the subject. ?result binds to the action's output.

Payload-Only

When the action has no subject (like a creation action), all arguments are property-value pairs:

PREFIX tasks: <https://example.org/spec/tasks#>

?result tasks:CreateTask (
    tasks:title "Review Q3"
    tasks:priority "high"
) .

Each pair is a predicate followed by a value. The pairs are assembled into a payload entity and validated against the action's rars-act:payloadScheme before the handler executes.

Subject with Payload

The subject is always the first argument when present:

PREFIX tasks: <https://example.org/spec/tasks#>

?result tasks:UpdateStatus (
    ?task                          # Subject
    tasks:status tasks:InProgress  # Payload property
    tasks:note "Starting work"     # Payload property
) .

How RARS distinguishes subject from payload: if the action declares rars-act:subjectRequired true, the first argument is always the subject. If the action has rars-act:subjectScheme but subject is optional, RARS uses argument count parity (odd means subject is present, even means all pairs are payload).

Result Binding

The result variable binds to the action's output. If the action returns multiple results, the variable binds once per result, producing multiple solution rows:

PREFIX tasks: <https://example.org/spec/tasks#>

# ListTasks returns multiple tasks, one binding per task
?task tasks:ListTasks () .
?task tasks:title ?title .

This joins the action results with a subsequent pattern, like any other SPARQL join.

Variable Arguments

Arguments can be variables bound earlier in the script:

PREFIX rars-iam:       <https://poliglot.io/rars/spec/iam#>
PREFIX rars-ws: <https://poliglot.io/rars/spec/workspace#>

# Get the current user
?user rars-iam:GetCurrentUser () .

# Use the user as subject for another action
?workspaces rars-ws:ListWorkspaces (?user) .

This chains actions: the result of one becomes the input to the next.

In Script Handlers

Property functions are the mechanism behind script handler workflows. A script handler's SPARQL script can invoke any action, regardless of handler type:

PREFIX tasks: <https://example.org/spec/tasks#>

# ServiceIntegration action
?details tasks:GetTask (?task) .

# AgenticHandler action
?assessment tasks:AssessRisk (?task) .

# HumanInTheLoop action
?approval tasks:RequestApproval (?task tasks:assessment ?assessment) .

The script doesn't know or care what handler type each action uses. It invokes by name and gets typed results back.

See Also

  • Script Handlers: using property functions in multi-step workflows
  • Actions: action design, I/O contracts, subject dispatch
  • Basics: the SPARQL patterns that property functions integrate with

On this page