-
Notifications
You must be signed in to change notification settings - Fork 23
/
option-b-notes.text
90 lines (70 loc) · 2.59 KB
/
option-b-notes.text
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
Option B, defining variables by SPARQL queries.
Part A: mapping declarations
A variable declaration may mention a map in its
api:value
...
; api:variable
[ api:name "var_A"
; api:value
[ elda:mapFrom "argument"
; elda:mapWith example:map
]
]
...
If the api:value of a variable is a resource (in the
example, it's a bnode), then the value of that variable
is obtained by running the named query (above, example:map
as referred to with elda:mapWith) with input argument
"argument" and using the output of the query as
the value of this variable.
The value of the variable is its api:value as translated
by the map [1].
A map is represented by a resource and referred to (in a
variable declaration) by its resource name. If a map is a bnode,
it can be given a name using a mapName property. A map
must have rdf:type elda:SPARQLMap.
example:map a elda:SPARQLMap
# ; elda:mapName "http://www.epimorphics.com/vocabularies/lda#example.map"
; elda:mapIn "param"
; elda:mapQuery
"""
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
select ?out where {?out rdfs:label ?param} limit 1
"""
; elda:mapOut "out"
.
the mapIn property names the variable name bound to the
input to the map, here "param". If omitted it defaults
to "input".
the mapQuery property gives the text of the SPARQL query
that implements the map. Any defined (ie given a value)
variable that appears in the query, eg ?param, is replaced
by its value.
The variable named by mapOut is the variable who's value
is the output of the map. If omitted it defaults to "result".
Part B: #includes
[not integrated into mappings yet]
When a config file is being read, it may
contain lines of the form:
#include fileName
The contents of the named file are inserted into
the input. That content may contain further #includes
in turn.
If an error occurs while reading a config file, Elda's
error report will refer to a line within the complete
concatenated stream and also mention the file within
which the error occurred and the line number within
that file.
If, while including a file A, a #include A is encountered,
Elda reports an error.
The same file may be included several times. This is not
an error, nor is the file cached -- the results of an
include depend on the most recently read prefixes, for
example:
@prefix x: <http://example.org/A>
#include fileA
@prefix x: <http://exampl.org>/B>
#include fileA
Uses of x: in fileA will expand to <http://example.org/A>
in the first inclusion and <http://example.org/B> in the
second.