use of it.unibo.arces.wot.sepa.commons.sparql.RDFTermURI in project SEPA by arces-wot.
the class ApplicationProfile method updateBindings.
/**
* <pre>"forcedBindings" : {
* "variable_1" : {
* "type" : "literal" ,
* "value" : ""}
* ,
* "variable_2" : {
* "type" : "literal" ,
* "value" : ""}
* ,
* "variable_N" : {
* "type" : "uri" ,
* "value" : ""}
* }</pre>
*/
public Bindings updateBindings(String selectedValue) {
JsonElement elem;
Bindings ret = new Bindings();
if ((elem = doc.get("updates")) != null)
if ((elem = elem.getAsJsonObject().get(selectedValue)) != null)
if ((elem = elem.getAsJsonObject().get("forcedBindings")) != null) {
for (Entry<String, JsonElement> binding : elem.getAsJsonObject().entrySet()) {
JsonObject value = binding.getValue().getAsJsonObject();
RDFTerm bindingValue = null;
if (value.get("type") != null) {
if (value.get("type").getAsString().equals("uri")) {
bindingValue = new RDFTermURI(value.get("value").getAsString());
} else {
bindingValue = new RDFTermLiteral(value.get("value").getAsString());
}
}
ret.addBinding(binding.getKey(), bindingValue);
}
}
return ret;
}
use of it.unibo.arces.wot.sepa.commons.sparql.RDFTermURI in project SEPA by arces-wot.
the class EventListener method startListeningForEvent.
public void startListeningForEvent(String eventURI) throws SEPAProtocolException, SEPASecurityException {
if (allEventListener.containsKey(eventURI))
return;
AllEventListener listener = new AllEventListener(eventURI);
allEventListener.put(eventURI, listener);
Bindings bindings = new Bindings();
bindings.addBinding("event", new RDFTermURI(eventURI));
allEventListener.get(eventURI).subscribe(bindings);
}
use of it.unibo.arces.wot.sepa.commons.sparql.RDFTermURI in project SEPA by arces-wot.
the class ActionPublisher method post.
public void post(String value, String dataTypeURI) {
Bindings bind = new Bindings();
bind.addBinding("action", new RDFTermURI(action));
bind.addBinding("value", new RDFTermLiteral(value));
publisherWithInput.update(bind);
}
use of it.unibo.arces.wot.sepa.commons.sparql.RDFTermURI in project SEPA by arces-wot.
the class ActionPublisher method post.
public void post() {
Bindings bind = new Bindings();
bind.addBinding("action", new RDFTermURI(action));
bind.addBinding("newInstance", new RDFTermURI("wot:" + UUID.randomUUID()));
update(bind);
}
use of it.unibo.arces.wot.sepa.commons.sparql.RDFTermURI in project SEPA by arces-wot.
the class ThingDescription method addPropertyChangedEvent.
public void addPropertyChangedEvent(String event, String name, String dataType) {
Bindings bind = new Bindings();
bind.addBinding("thing", thing);
bind.addBinding("event", new RDFTermURI(event));
bind.addBinding("name", new RDFTermLiteral(name));
bind.addBinding("dataType", new RDFTermURI(dataType));
propertyChangeEvents.update(bind);
}
Aggregations