Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
tobias.kaefer
wild-demo
Commits
c05884d8
Commit
c05884d8
authored
Oct 10, 2018
by
Tobias Käfer
Browse files
iteration
parent
f762afd3
Pipeline
#29595
failed with stages
Changes
7
Pipelines
1
Show whitespace changes
Inline
Side-by-side
captiveportal.html
View file @
c05884d8
...
...
@@ -17,21 +17,22 @@
</style>
<script
language=
"javascript"
>
var
ldpcHost
=
"
tok450s.lan:8080
"
var
ldpcPath
=
"
/ldbbc/
"
var
ldpc
=
"
http://
"
+
ldpcHost
+
ldpcPath
;
var
instance
=
{
"
@id
"
:
"
#it
"
,
"
@type
"
:
"
wild:WorkflowInstance
"
,
"
wild:hasWorkflowModel
"
:
"
http://ldp.local/ldpc/iswcdemo-model.ttl#wfm
"
,
"
wild:hasState
"
:
"
wild:uninitialised
"
,
"
wild:hasInput
"
:
"
#input
"
"
wild:hasWorkflowModel
"
:
"
http://tok450s.lan/ldbbc/demoworkflow_new.ttl#wfm
"
,
"
wild:hasState
"
:
"
wild:uninitialised
"
};
var
context
=
{
"
name
"
:
"
http://xmlns.com/foaf/0.1/name
"
,
"
home
"
:
"
http://people.aifb.kit.edu/co1683/2018/iswcdemo/vocab#home
"
,
//
"home": "http://people.aifb.kit.edu/co1683/2018/iswcdemo/vocab#home",
"
wild
"
:
"
http://purl.org/wild/vocab#
"
,
"
wild:hasWorkflowModel
"
:
{
"
@type
"
:
"
@id
"
},
"
wild:hasState
"
:
{
"
@type
"
:
"
@id
"
},
"
wild:hasInput
"
:
{
"
@type
"
:
"
@id
"
}
"
wild:hasState
"
:
{
"
@type
"
:
"
@id
"
}
};
// Convert a HTML form to JSON
...
...
@@ -48,29 +49,56 @@ function getJSON(event) {
// preventing the default action of the button event
event
.
preventDefault
();
// reading the form contents into a JSON object
var
input
=
{};
formToJSON
(
event
.
target
.
elements
,
input
);
//
// reading the form contents into a JSON object
//
var input = {};
//
formToJSON(event.target.elements, input);
// building a JSON-LD object from the object
var
jsonld
=
{
"
@context
"
:
context
,
"
@graph
"
:
[
instance
,
input
instance
//
input
]
};
// displaying the POST request to be made using the JSON-LD object
document
.
getElementById
(
'
JSON
'
).
innerHTML
=
"
<pre>
"
+
"
POST
/ldpc/
HTTP/1.1
\n
"
+
"
Host:
ldp.local
\n
"
+
"
POST
"
+
ldpcPath
+
"
HTTP/1.1
\n
"
+
"
Host:
"
+
ldpcHost
+
"
\n
"
+
"
Content-type: application/ld+json
\n
"
+
"
\n
"
+
JSON
.
stringify
(
jsonld
,
null
,
2
)
+
"
</pre>
"
;
}
function
sendJSON
(
event
)
{
// preventing the default action of the button event
event
.
preventDefault
();
// // reading the form contents into a JSON object
// var input = {};
// formToJSON(event.target.elements, input);
// building a JSON-LD object from the object
var
jsonld
=
{
"
@context
"
:
context
,
"
@graph
"
:
[
instance
// input
]
};
$
.
ajax
({
type
:
"
POST
"
,
url
:
ldpc
,
contentType
:
"
application/ld+json
"
,
data
:
JSON
.
stringify
(
jsonld
,
null
,
2
),
processData
:
false
,
error
:
()
=>
{
window
.
alert
(
"
request failed
"
)
}
});
}
</script>
</head>
...
...
@@ -82,10 +110,10 @@ function getJSON(event) {
</nav>
<h3>
Demo: Using Workflows to Build Compositions of Read-Write Linked Data APIs on the Web of Things
</h3>
<p>
Add a workflow instance using the following information:
</p>
<!--
<p>Add a workflow instance using the following information:</p>
-->
<form
id=
"name-and-town"
class=
"text-
left
"
>
<div
class=
"form-group"
>
<form
id=
"name-and-town"
class=
"text-
center
"
>
<!--
<div class="form-group">
<input name="@id" type="hidden" value="#input"></input>
<label for="name">Name:</label>
<input id="name" name="name" class="form-control"></input>
...
...
@@ -93,13 +121,29 @@ function getJSON(event) {
<div class="form-group">
<label for="home">Hometown:</label>
<input id="home" name="home" class="form-control"></input><br>
</div> -->
<button
type=
"submit"
class=
"btn"
>
Show Workflow Instance Request
</button>
</form>
<br
/>
<form
id=
"submit-workflow"
class=
"text-center"
>
<!-- <div class="form-group">
<input name="@id" type="hidden" value="#input"></input>
<label for="name">Name:</label>
<input id="name" name="name" class="form-control"></input>
</div>
<button
type=
"submit"
class=
"btn btn-primary"
>
Create Workflow Instance
</button>
<div class="form-group">
<label for="home">Hometown:</label>
<input id="home" name="home" class="form-control"></input><br>
</div> -->
<button
type=
"submit"
class=
"btn btn-primary"
>
Submit Workflow Instance
</button>
</form>
<script
language=
"javascript"
>
// register the code with the form
document
.
getElementById
(
'
name-and-town
'
).
addEventListener
(
"
submit
"
,
getJSON
);
document
.
getElementById
(
'
submit-workflow
'
).
addEventListener
(
"
submit
"
,
sendJSON
);
</script>
<br
/>
...
...
data-retrieval.n3
→
data-retrieval
-ldpc
.n3
View file @
c05884d8
...
...
@@ -6,4 +6,3 @@
{ <http://tok450s.lan:8080/ldbbc/> ldp:contains ?y . } => { [] http:mthd http_m:GET; http:requestURI ?y . } .
{ _:h http:mthd http_m:GET ; http:requestURI <http://tok450s.lan:5001/> . } # optimise for workflow activity activeness
demoworkflow.ttl
View file @
c05884d8
...
...
@@ -16,7 +16,6 @@
# Prefixes for the components of the demo:
@prefix
speaker:
<http://t2-speaker.lan/#>
.
@prefix
weather:
<http://weather-api.lan/#>
.
@prefix
light:
<http://t2-ambient.lan/light#>
.
@prefix
rfid-smiley:
<http://t2-rest-smiley.lan/#>
.
@prefix
rfid-frownie:
<http://t2-rest-frownie.lan/#>
.
...
...
@@ -35,29 +34,47 @@
#
<#root>
a
:
SequentialActivity
;
:
hasChildActivities
(
<#darkness
>
<#weather
Question>
<#
weatherAnswer
ConditionalSplit>
)
.
:
hasChildActivities
(
<#darknessQuestion>
<#
darkness
ConditionalSplit>
)
.
<#darkness>
a
:
AtomicActivity
;
:
hasPostcondition
<#
it-is-dark>
;
# implicit waiting
<#darkness
Question
>
a
:
AtomicActivity
;
:
hasPostcondition
<#
speakerQuiet>
;
:
hasHttpRequest
[
a
http:
Request
;
http:
mthd
http_m:
POST
;
http:
requestURI
speaker:
spk
;
http:
body
"{\"http://schema.org/text\":{\"@value\":\"Hello, user! Please make it dark!\",\"@language\":\"en\"}}"
]
.
http:
body
"{\"http://schema.org/text\":{\"@value\":\"Hello, user! Are you going to make it dark?\",\"@language\":\"en\"}}"
]
.
<#darknessConditionalSplit>
a
:
ConditionalActivity
;
:
hasChildActivities
(
<#dark>
<#bright>
)
.
<#dark>
a
:
ConditionalActivity
;
:
hasPrecondition
<#darknessPromisePreCondition>
;
:
hasChildActivities
(
<#dark-correct>
<#dark-incorrect>
)
.
<#weatherQuestion>
a
:
AtomicActivity
;
<#bright>
a
:
ConditionalActivity
;
:
hasPrecondition
<#brightnessPromisePreCondition>
;
:
hasChildActivities
(
<#bright-correct>
<#bright-incorrect>
)
.
<#dark-correct>
a
:
AtomicActivity
;
:
hasPrecondition
<#dark-correct-pc>
;
# implicit waiting
:
hasPostcondition
<#speakerQuiet>
;
:
hasHttpRequest
[
a
http:
Request
;
http:
mthd
http_m:
POST
;
http:
requestURI
speaker:
spk
;
http:
body
"{\"http://schema.org/text\":{\"@value\":\"
How is the weather at home?
\",\"@language\":\"en\"}}"
]
.
http:
body
"{\"http://schema.org/text\":{\"@value\":\"
Well Done!
\",\"@language\":\"en\"}}"
]
.
<#weatherAnswerConditionalSplit>
a
:
ConditionalActivity
;
:
hasChildActivities
(
<#well-done>
<#oh-dear>
)
.
<#dark-incorrect>
a
:
AtomicActivity
;
:
hasPrecondition
<#dark-incorrect-pc>
;
# implicit waiting
:
hasPostcondition
<#speakerQuiet>
;
:
hasHttpRequest
[
a
http:
Request
;
http:
mthd
http_m:
POST
;
http:
requestURI
speaker:
spk
;
http:
body
"{\"http://schema.org/text\":{\"@value\":\"Oh dear, you have no clue!\",\"@language\":\"en\"}}"
]
.
<#
well-done
>
a
:
AtomicActivity
;
:
hasPrecondition
<#
good-good>
,
<#bad-bad>
;
# one must be fulfilled,
implicit waiting
<#
bright-correct
>
a
:
AtomicActivity
;
:
hasPrecondition
<#
bright-correct-pc>
;
#
implicit waiting
:
hasPostcondition
<#speakerQuiet>
;
:
hasHttpRequest
[
a
http:
Request
;
...
...
@@ -65,8 +82,8 @@
http:
requestURI
speaker:
spk
;
http:
body
"{\"http://schema.org/text\":{\"@value\":\"Well Done!\",\"@language\":\"en\"}}"
]
.
<#
oh-dear
>
a
:
AtomicActivity
;
:
hasPrecondition
<#b
ad-good>
,
<#good-bad>
;
# one must be fulfilled,
implicit waiting
<#
bright-incorrect
>
a
:
AtomicActivity
;
:
hasPrecondition
<#b
right-incorrect-pc>
;
#
implicit waiting
:
hasPostcondition
<#speakerQuiet>
;
:
hasHttpRequest
[
a
http:
Request
;
...
...
@@ -85,37 +102,54 @@
sp:
predicate
<http://example.org/speaking>
;
sp:
object
"false"
^^
xsd:
boolean
])
.
<#
good-good
>
a
sp:
Ask
;
<#
darknessPromisePreCondition
>
a
sp:
Ask
;
sp:
where
(
[
sp:
subject
rfid-frownie:
sensor
;
sp:
predicate
rdf:
value
;
sp:
object
"true"
^^
xsd:
boolean
]
[
sp:
subject
weather:
api
;
[
sp:
subject
rfid-smiley:
sensor
;
sp:
predicate
rdf:
value
;
sp:
object
"
good"
]
)
.
<#b
ad-bad
>
a
sp:
Ask
;
sp:
object
"
false"
^^
xsd:
boolean
]
)
.
<#b
rightnessPromisePreCondition
>
a
sp:
Ask
;
sp:
where
(
[
sp:
subject
rfid:
sensor
;
[
sp:
subject
rfid
-smiley
:
sensor
;
sp:
predicate
rdf:
value
;
sp:
object
"
bad"
]
[
sp:
subject
weather:
api
;
sp:
object
"
true"
^^
xsd:
boolean
]
[
sp:
subject
rfid-frownie:
sensor
;
sp:
predicate
rdf:
value
;
sp:
object
"bad"
]
)
.
<#good-bad>
a
sp:
Ask
;
sp:
object
"false"
^^
xsd:
boolean
]
)
.
<#dark-correct-pc>
a
sp:
Ask
;
sp:
where
(
[
sp:
subject
rfid:
sensor
;
sp:
predicate
rdf:
value
;
sp:
object
"good"
]
[
sp:
subject
weather:
api
;
sp:
object
"true"
^^
xsd:
boolean
]
[
sp:
subject
light:
sensor
;
sp:
predicate
<http://example.org/isBright>
;
sp:
object
"false"
^^
xsd:
boolean
]
)
.
<#dark-incorrect-pc>
a
sp:
Ask
;
sp:
where
(
[
sp:
subject
rfid:
sensor
;
sp:
predicate
rdf:
value
;
sp:
object
"bad"
]
)
.
<#bad-good>
a
sp:
Ask
;
sp:
object
"true"
^^
xsd:
boolean
]
[
sp:
subject
light:
sensor
;
sp:
predicate
<http://example.org/isBright>
;
sp:
object
"true"
^^
xsd:
boolean
]
)
.
<#bright-correct-pc>
a
sp:
Ask
;
sp:
where
(
[
sp:
subject
rfid:
sensor
;
sp:
predicate
rdf:
value
;
sp:
object
"bad"
]
[
sp:
subject
weather:
api
;
sp:
object
"true"
^^
xsd:
boolean
]
[
sp:
subject
light:
sensor
;
sp:
predicate
<http://example.org/isBright>
;
sp:
object
"true"
^^
xsd:
boolean
]
)
.
<#bright-incorrect-pc>
a
sp:
Ask
;
sp:
where
(
[
sp:
subject
rfid:
sensor
;
sp:
predicate
rdf:
value
;
sp:
object
"good"
]
)
.
sp:
object
"true"
^^
xsd:
boolean
]
[
sp:
subject
light:
sensor
;
sp:
predicate
<http://example.org/isBright>
;
sp:
object
"false"
^^
xsd:
boolean
]
)
.
<#truePostCondition>
a
sp:
Ask
;
sparql-result:
boolean
"true"
^^
xsd:
boolean
.
frownie.n3
0 → 100644
View file @
c05884d8
@prefix http: <http://www.w3.org/2011/http#>.
@prefix http_m: <http://www.w3.org/2011/http-methods#>.
@prefix ldp: <http://www.w3.org/ns/ldp#> .
{ _:h http:mthd http_m:GET ; http:requestURI <http://t2-rest-frownie.lan/> . }
lightCheck.n3
View file @
c05884d8
...
...
@@ -8,4 +8,5 @@
{ _:h http:mthd http_m:GET ; http:requestURI <http://t2-ambient-relay.lan:8080/ambient/light> . }
{ <http://t2-ambient-relay.lan:8080/ambient/light#value> <http://example.org/hasLightValue> ?val . ?val math:lessThan "0.08"^^xsd:double . } => { <http://tok450s.lan:8080/rwldresources/testworkflow.ttl#bPostCon> sparql-results:boolean "true"^^xsd:boolean . } .
{ ?x <http://example.org/hasLightValue> ?val . ?val math:lessThan "0.08"^^xsd:double . } => { ?x <http://example.org/isBright> "false"^^xsd:boolean . } .
{ ?x <http://example.org/hasLightValue> ?val . ?val math:notLessThan "0.08"^^xsd:double . } => { ?x <http://example.org/isBright> "true"^^xsd:boolean . } .
runIt.sh
View file @
c05884d8
...
...
@@ -6,5 +6,5 @@ curl -f -X PUT -T demoworkflow.ttl http://tok450s.lan:8080/ldbbc/ -Hcontent-type
curl
-f
-X
PUT
-T
wild-vocab.ttl http://tok450s.lan:8080/ldbbc/wild-vocab.ttl
-L
-Hcontent-type
:text/turtle
||
exit
3
curl
-f
-X
PUT
-T
list-vocab.ttl http://tok450s.lan:8080/ldbbc/list-vocab.ttl
-L
-Hcontent-type
:text/turtle
||
exit
4
JAVA_OPTS
=
-Dldfu
.optimiser
=
OFF
$ldf
-p
data-retrieval.n3
-p
wild-semantics.n3
-p
list-semantics.n3
-p
selected_ontology_semantics.n3
-p
spin_sparql_ask_where_query_processing.n3
-n
100
# fish-sync...
JAVA_OPTS
=
-Dldfu
.optimiser
=
OFF
$ldf
-p
data-retrieval
-ldpc
.n3
-p
wild-semantics.n3
-p
list-semantics.n3
-p
selected_ontology_semantics.n3
-p
spin_sparql_ask_where_query_processing.n3
-n
100
# fish-sync...
smiley.n3
0 → 100644
View file @
c05884d8
@prefix http: <http://www.w3.org/2011/http#>.
@prefix http_m: <http://www.w3.org/2011/http-methods#>.
@prefix ldp: <http://www.w3.org/ns/ldp#> .
{ _:h http:mthd http_m:GET ; http:requestURI <http://t2-rest-smiley.lan/> . }
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment