use of it.unibo.arces.wot.sepa.commons.sparql.RDFTermLiteral 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.RDFTermLiteral 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.RDFTermLiteral 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);
}
use of it.unibo.arces.wot.sepa.commons.sparql.RDFTermLiteral in project SEPA by arces-wot.
the class ThingDescription method addAction.
public void addAction(String action, String name, String protocol) {
Bindings bind = new Bindings();
bind.addBinding("thing", thing);
bind.addBinding("action", new RDFTermURI(action));
bind.addBinding("name", new RDFTermLiteral(name));
bind.addBinding("protocol", new RDFTermURI(protocol));
actions.update(bind);
}
use of it.unibo.arces.wot.sepa.commons.sparql.RDFTermLiteral in project SEPA by arces-wot.
the class SmartLightingBenchmark method updateLamp.
protected boolean updateLamp(int nRoad, int nLamp, Integer dimming) {
String lampURI = "bench:Lamp_" + nRoad + "_" + nLamp;
Bindings bindings = new Bindings();
bindings.addBinding("lamp", new RDFTermURI(lampURI));
bindings.addBinding("dimming", new RDFTermLiteral(dimming.toString()));
long startTime = System.nanoTime();
Response ret = lampUpdater.update(bindings);
long stopTime = System.nanoTime();
logger.info("UPDATE LAMP " + lampURI + " " + (stopTime - startTime));
return ret.getClass().equals(UpdateResponse.class);
}
Aggregations