You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `@bind` directive is used to associate a field in your GraphQL query or schema with a SPARQL expression. Note that [`@pattern`](pattern) is for graph patterns rather than expressions.
11
+
As bind only produces a single value from the input binding, its cardinality defaults to `@one`. Explicitly adding `@many` will cause the value to be wrapped in an array.
12
+
13
+
### Purpose
14
+
15
+
The directive allows one to compute values for a field based on variables that are mentioned in any ancestor node. The most common use is to expose an entity's IRI (or blank node) as an `id` field.
16
+
17
+
#### Usage
18
+
19
+
The `@bind` directive supports the following arguments:
20
+
21
+
-**`of`** (`String`): The value of `of` is a SPARQL expression. The mentioned variables must be defined in any ancestor or at the annotated field.
22
+
-**`as`** (`String`): (optional) The variable for the expression result can be specified explicitly (by default an internal name is generated).
23
+
-**`target`** (`Boolean`): (optional, defaults to `true`) Whether the `@bind` expression produces the target values for the annotated field.
24
+
If `target` is `false` then the field introduces the specified variable that can be referenced from descendants without it becoming a target of the field.
25
+
Multiple target variables are combined into a tuple based on the order of their appearance.
26
+
27
+
#### Example
28
+
29
+
Here is an example demonstrating how to define a `MusicalArtists` field using the `@bind` directive:
30
+
31
+
```graphql
32
+
{
33
+
MusicalArtists@pattern(of: "?s a <http://dbpedia.org/ontology/MusicalArtist>") {
0 commit comments