-
Notifications
You must be signed in to change notification settings - Fork 5
/
hello-world.sms.ttl
94 lines (92 loc) · 2.84 KB
/
hello-world.sms.ttl
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
# baseURI: http://onto.fel.cvut.cz/ontologies/s-pipes/hello-world-example-0.1
# imports: http://onto.fel.cvut.cz/ontologies/s-pipes-lib
@prefix : <http://onto.fel.cvut.cz/ontologies/s-pipes/hello-world-example-0.1/> .
@prefix doc: <http://onto.fel.cvut.cz/ontologies/documentation/> .
@prefix kbss-module: <http://onto.fel.cvut.cz/ontologies/lib/module/> .
@prefix km-sesame: <http://onto.fel.cvut.cz/ontologies/lib/module/sesame/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sm: <http://topbraid.org/sparqlmotion#> .
@prefix sml: <http://topbraid.org/sparqlmotionlib#> .
@prefix sp: <http://spinrdf.org/sp#> .
@prefix spif: <http://spinrdf.org/spif#> .
@prefix spin: <http://spinrdf.org/spin#> .
@prefix spl: <http://spinrdf.org/spl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://onto.fel.cvut.cz/ontologies/s-pipes/hello-world-example-0.1>
a owl:Ontology ;
owl:imports <http://onto.fel.cvut.cz/ontologies/s-pipes-lib> ;
.
:bind-person-name
a sml:BindWithConstant ;
sm:next :bind-person-id ;
sm:outputVariable "personName" ;
sml:value [
a sp:concat ;
sp:arg1 [
sp:varName "firstName" ;
] ;
sp:arg2 " " ;
sp:arg3 [
sp:varName "lastName" ;
] ;
] ;
rdfs:label "Bind person name" ;
.
:bind-person-id
a sml:BindBySelect ;
sm:next :construct-greeting ;
sml:selectQuery [
a sp:Select ;
sp:text """
SELECT ?personId
WHERE {
BIND(replace(lcase(?personName)," ", "-") as ?personId)
}
""" ;
] ;
rdfs:label "Bind person id" ;
.
:construct-greeting
a sml:ApplyConstruct ;
sm:next :express-greeting_Return ;
sml:constructQuery [
a sp:Construct ;
sp:text """
PREFIX : <http://onto.fel.cvut.cz/ontologies/s-pipes/hello-world-example-0.1/>
CONSTRUCT {
?person :is-greeted-by-message ?greetingMessage .
} WHERE {
BIND(iri(concat(str(:), ?personId)) as ?person)
BIND(concat("Hello ", ?personName, ".") as ?greetingMessage)
}
""" ;
] ;
sml:replace true ;
rdfs:label "Construct greeting" ;
.
:execute-greeting
a sm:Function ;
sm:returnModule :express-greeting_Return ;
rdfs:comment "This function constructs a hello world message for a person given their first and last name." ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate :firstName ;
spl:optional "false"^^xsd:boolean ;
rdfs:label "first name" ;
rdfs:comment "The first name of the greeted person" ;
] ;
spin:constraint [
rdf:type spl:Argument ;
spl:predicate :lastName ;
spl:optional "false"^^xsd:boolean ;
rdfs:label "last name" ;
rdfs:comment "The last name of the greeted person" ;
] ;
.
:express-greeting_Return
a sml:ReturnRDF ;
sml:serialization sml:JSONLD ;
rdfs:label "Return greeting statement" ;
.