-
Notifications
You must be signed in to change notification settings - Fork 4
/
rdf4j-update.sms.ttl
66 lines (60 loc) · 2.16 KB
/
rdf4j-update.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
# baseURI: http://onto.fel.cvut.cz/ontologies/s-pipes/rdf-update-example
# imports: http://onto.fel.cvut.cz/ontologies/s-pipes-lib
@prefix : <http://onto.fel.cvut.cz/ontologies/s-pipes/rdf-update-example/> .
@prefix doc: <http://onto.fel.cvut.cz/ontologies/documentation/> .
@prefix kbss: <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#> .
@prefix rdf4j: <http://onto.fel.cvut.cz/ontologies/lib/module/rdf4j/> .
<http://onto.fel.cvut.cz/ontologies/s-pipes/rdf-update-example>
a owl:Ontology ;
owl:imports <http://onto.fel.cvut.cz/ontologies/s-pipes-lib> ;
.
:create-repository
a kbss:rdf4j-create-repository ;
rdf4j:p-rdf4j-server-url "http://localhost:8080/rdf4j-server/" ;
rdf4j:p-rdf4j-repository-name "test-update" ;
rdf4j:p-rdf4j-ignore-if-exists "true" ;
sm:next :update-repository ;
.
:update-repository
a kbss:rdf4j-update ;
sm:next :update-repository_Return ;
sml:updateQuery [
a sp:Update ;
sp:text """
DELETE {
<http://example.org/people/john> <http://example.org/people/age> ?oldAge .
}
INSERT {
<http://example.org/people/john> <http://example.org/people/age> ?newAge .
} WHERE {
OPTIONAL {
<http://example.org/people/john> <http://example.org/people/age> ?oldAge .
}
BIND(COALESCE(?oldAge+1, 1) as ?newAge)
}
""" ;
];
rdf4j:p-rdf4j-server-url "http://localhost:8080/rdf4j-server/" ;
rdf4j:p-rdf4j-repository-name "test-update" ;
.
:update-repository_Return
a sml:ReturnRDF ;
sml:serialization sml:JSONLD ;
rdfs:label "Update repository" ;
.
:update-repository
a sm:Function ;
sm:returnModule :update-repository_Return ;
rdfs:subClassOf sm:Functions ;
.