-
Notifications
You must be signed in to change notification settings - Fork 6
/
swagger.yaml
149 lines (142 loc) · 8.5 KB
/
swagger.yaml
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# The version of the API is set based on the version in package.json.
openapi: "3.0.0"
info:
description: "This is a Web API around the RMLMapper. You are able to execute RML rules on different data sources. Optionally, you can also request for the metadata that is generated during the execution of the rules."
title: "RMLMapper Web API"
contact:
name: RML.io
email: [email protected]
url: https://rml.io/
schemes:
- "http"
paths:
/:
get:
summary: "Information page of the Web API"
produces:
- "text/html"
responses:
200:
description: "HTML with information about the Web API"
content:
text/html:
schema:
type: string
/execute:
post:
summary: "Execute RML rules"
description: ""
requestBody:
description: The RML rules in Turtle format.
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/Execute"
examples:
Basic:
value:
rml: "@prefix rr: <http://www.w3.org/ns/r2rml#>. @prefix rml: <http://semweb.mmlab.be/ns/rml#>. @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. @prefix ql: <http://semweb.mmlab.be/ns/ql#>. @prefix map: <http://mapping.example.com/>. map:map_person_0 rml:logicalSource map:source_0; a rr:TriplesMap; rdfs:label \"person\"; rr:subjectMap map:s_0; rr:predicateObjectMap map:pom_0, map:pom_1. map:om_0 a rr:ObjectMap; rr:constant \"http://xmlns.com/foaf/0.1/Person\"; rr:termType rr:IRI. map:om_1 a rr:ObjectMap; rml:reference \"firstname\"; rr:termType rr:Literal. map:pm_0 a rr:PredicateMap; rr:constant rdf:type. map:pm_1 a rr:PredicateMap; rr:constant <http://example.com/name>. map:pom_0 a rr:PredicateObjectMap; rr:predicateMap map:pm_0; rr:objectMap map:om_0. map:pom_1 a rr:PredicateObjectMap; rr:predicateMap map:pm_1; rr:objectMap map:om_1. map:s_0 a rr:SubjectMap; rr:template \"http://example.com/{firstname}\". map:source_0 a rml:LogicalSource; rml:source \"data.json\"; rml:iterator \"$.persons[*]\"; rml:referenceFormulation ql:JSONPath."
functionStateId: "1688549879688"
sources:
data.json: "{ \"persons\": [ { \"firstname\": \"John\", \"lastname\": \"Doe\" }, { \"firstname\": \"Jane\", \"lastname\": \"Smith\" }, { \"firstname\": \"Sarah\", \"lastname\": \"Bladinck\" } ] }"
Target:
value:
rml: >-
@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix ex: <http://example.com/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rml: <http://semweb.mmlab.be/ns/rml#> .
@prefix ql: <http://semweb.mmlab.be/ns/ql#> .
@prefix rmlt: <http://semweb.mmlab.be/ns/rml-target#> .
@prefix void: <http://rdfs.org/ns/void#> .
@prefix formats: <http://www.w3.org/ns/formats/> .
@base <http://example.com/base/> .
<TriplesMap1>
a rr:TriplesMap;
rml:logicalSource [
rml:source "student.csv";
rml:referenceFormulation ql:CSV
];
rr:subjectMap [
rr:template "http://example.com/{Name}";
rml:logicalTarget [
a rmlt:LogicalTarget;
rmlt:target [
a void:Dataset ;
void:dataDump <file://./dump1.nt>];
rmlt:serialization formats:N-Triples
];
];
rr:predicateObjectMap [
rr:predicate foaf:name;
rr:objectMap [
rml:reference "Name"
]
];
rr:predicateObjectMap [
rr:predicate ex:number;
rr:objectMap [
rml:reference "number";
rml:logicalTarget [
a rmlt:LogicalTarget;
rmlt:target [
a void:Dataset ;
void:dataDump <file://./dump2.nt>];
rmlt:serialization formats:N-Triples
]
]
].
sources:
student.csv: |-
Name,number
Venus,1
responses:
200:
description: "The generated RDF is returned. Optionally, with the metadata of the generation."
content:
application/json:
schema:
$ref: "#/components/schemas/ExecuteOutput"
400:
description: "invalid input"
500:
description: "Internal server error during execution of RML rules"
components:
schemas:
Execute:
type: "object"
properties:
rml:
type: "string"
description: "RML rules to map data from `sources` to RDF, in Turtle syntax."
example: "@prefix rr: <http://www.w3.org/ns/r2rml#>. @prefix rml: <http://semweb.mmlab.be/ns/rml#>. @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>. @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>. @prefix ql: <http://semweb.mmlab.be/ns/ql#>. @prefix map: <http://mapping.example.com/>. map:map_person_0 rml:logicalSource map:source_0; a rr:TriplesMap; rdfs:label \"person\"; rr:subjectMap map:s_0; rr:predicateObjectMap map:pom_0, map:pom_1. map:om_0 a rr:ObjectMap; rr:constant \"http://xmlns.com/foaf/0.1/Person\"; rr:termType rr:IRI. map:om_1 a rr:ObjectMap; rml:reference \"firstname\"; rr:termType rr:Literal. map:pm_0 a rr:PredicateMap; rr:constant rdf:type. map:pm_1 a rr:PredicateMap; rr:constant <http://example.com/name>. map:pom_0 a rr:PredicateObjectMap; rr:predicateMap map:pm_0; rr:objectMap map:om_0. map:pom_1 a rr:PredicateObjectMap; rr:predicateMap map:pm_1; rr:objectMap map:om_1. map:s_0 a rr:SubjectMap; rr:template \"http://example.com/{firstname}\". map:source_0 a rml:LogicalSource; rml:source \"data.json\"; rml:iterator \"$.persons[*]\"; rml:referenceFormulation ql:JSONPath."
functionStateId:
type: "string"
example: "1688549879688"
description: "Optional. The caller of the request is responsible for choosing a value.
It is used as a key to identify the state used by stateful functions during the
RML mapping process. Requests with the same value for `functionStateId` use the
same state, which gets initialized during the first request with that value."
sources:
type: "object"
example: >
{
"data.json": "{ \"persons\": [ { \"firstname\": \"John\", \"lastname\": \"Doe\" }, { \"firstname\": \"Jane\", \"lastname\": \"Smith\" }, { \"firstname\": \"Sarah\", \"lastname\": \"Bladinck\" } ] }"
}
generateMetadata:
type: "boolean"
default: false
serialization:
type: "string"
default: "nquads"
ExecuteOutput:
type: "object"
properties:
output:
type: "string"
example: "<http://example.com/John> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person>.\n<http://example.com/John> <http://example.com/name> \"John\".\n<http://example.com/Jane> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person>.\n<http://example.com/Jane> <http://example.com/name> \"Jane\".\n<http://example.com/Sarah> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/Person>.\n<http://example.com/Sarah> <http://example.com/name> \"Sarah\".\n"
metadata:
type: "string"
example: null