Search in sources :

Example 11 with RDFTermLiteral

use of it.unibo.arces.wot.sepa.commons.sparql.RDFTermLiteral in project SEPA by arces-wot.

the class LCDProducer method justText.

private static void justText(Producer client) {
    Bindings bind = new Bindings();
    while (true) {
        bind = new Bindings();
        bind.addBinding("value", new RDFTermLiteral("Let Things Talk"));
        client.update(bind);
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        bind = new Bindings();
        bind.addBinding("value", new RDFTermLiteral("Vaimee!"));
        client.update(bind);
        try {
            Thread.sleep(1000);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
}
Also used : Bindings(it.unibo.arces.wot.sepa.commons.sparql.Bindings) RDFTermLiteral(it.unibo.arces.wot.sepa.commons.sparql.RDFTermLiteral)

Example 12 with RDFTermLiteral

use of it.unibo.arces.wot.sepa.commons.sparql.RDFTermLiteral in project SEPA by arces-wot.

the class MessageSender method sendMessage.

public boolean sendMessage(String receiver, String text) {
    message.addBinding("receiver", new RDFTermLiteral(receiver));
    message.addBinding("text", new RDFTermLiteral(text));
    Response ret = update(message);
    return ret.isUpdateResponse();
}
Also used : SubscribeResponse(it.unibo.arces.wot.sepa.commons.response.SubscribeResponse) Response(it.unibo.arces.wot.sepa.commons.response.Response) ErrorResponse(it.unibo.arces.wot.sepa.commons.response.ErrorResponse) RDFTermLiteral(it.unibo.arces.wot.sepa.commons.sparql.RDFTermLiteral)

Example 13 with RDFTermLiteral

use of it.unibo.arces.wot.sepa.commons.sparql.RDFTermLiteral in project SEPA by arces-wot.

the class MQTTAdapter method messageArrived.

@Override
public void messageArrived(String topic, MqttMessage value) throws Exception {
    logger.info(topic + " " + value.toString());
    Bindings bindings = new Bindings();
    bindings.addBinding("topic", new RDFTermLiteral(topic));
    bindings.addBinding("value", new RDFTermLiteral(value.toString()));
    bindings.addBinding("broker", new RDFTermLiteral(serverURI));
    update(bindings);
}
Also used : Bindings(it.unibo.arces.wot.sepa.commons.sparql.Bindings) RDFTermLiteral(it.unibo.arces.wot.sepa.commons.sparql.RDFTermLiteral)

Example 14 with RDFTermLiteral

use of it.unibo.arces.wot.sepa.commons.sparql.RDFTermLiteral in project SEPA by arces-wot.

the class MQTTServerMonitoring method addObservation.

private static void addObservation(Entry<String, JsonElement> mapping) {
    String topic = mapping.getKey();
    String observation = mapping.getValue().getAsJsonObject().get("observation").getAsString();
    String unit = mapping.getValue().getAsJsonObject().get("unit").getAsString();
    String location = mapping.getValue().getAsJsonObject().get("location").getAsString();
    String comment = mapping.getValue().getAsJsonObject().get("comment").getAsString();
    String label = mapping.getValue().getAsJsonObject().get("label").getAsString();
    Bindings bindings = new Bindings();
    bindings.addBinding("observation", new RDFTermURI(observation));
    bindings.addBinding("comment", new RDFTermLiteral(comment));
    bindings.addBinding("label", new RDFTermLiteral(label));
    bindings.addBinding("location", new RDFTermURI(location));
    bindings.addBinding("unit", new RDFTermURI(unit));
    bindings.addBinding("topic", new RDFTermLiteral(topic));
    logger.info("Add observation: " + bindings);
    mqttInitializer.update(bindings);
}
Also used : RDFTermURI(it.unibo.arces.wot.sepa.commons.sparql.RDFTermURI) Bindings(it.unibo.arces.wot.sepa.commons.sparql.Bindings) RDFTermLiteral(it.unibo.arces.wot.sepa.commons.sparql.RDFTermLiteral)

Example 15 with RDFTermLiteral

use of it.unibo.arces.wot.sepa.commons.sparql.RDFTermLiteral in project SEPA by arces-wot.

the class MQTTSmartifier method updateObservationValue.

private void updateObservationValue(String observation, String value) {
    Bindings bindings = new Bindings();
    bindings.addBinding("observation", new RDFTermURI(observation));
    bindings.addBinding("value", new RDFTermLiteral(value));
    logger.info("Update observation: " + bindings);
    update(bindings);
}
Also used : RDFTermURI(it.unibo.arces.wot.sepa.commons.sparql.RDFTermURI) Bindings(it.unibo.arces.wot.sepa.commons.sparql.Bindings) RDFTermLiteral(it.unibo.arces.wot.sepa.commons.sparql.RDFTermLiteral)

Aggregations

RDFTermLiteral (it.unibo.arces.wot.sepa.commons.sparql.RDFTermLiteral)22 Bindings (it.unibo.arces.wot.sepa.commons.sparql.Bindings)19 RDFTermURI (it.unibo.arces.wot.sepa.commons.sparql.RDFTermURI)15 ErrorResponse (it.unibo.arces.wot.sepa.commons.response.ErrorResponse)7 Response (it.unibo.arces.wot.sepa.commons.response.Response)7 SubscribeResponse (it.unibo.arces.wot.sepa.commons.response.SubscribeResponse)5 UpdateResponse (it.unibo.arces.wot.sepa.commons.response.UpdateResponse)3 JsonElement (com.google.gson.JsonElement)2 JsonObject (com.google.gson.JsonObject)2 RDFTerm (it.unibo.arces.wot.sepa.commons.sparql.RDFTerm)2 Producer (it.unibo.arces.wot.sepa.pattern.Producer)2 SEPAPropertiesException (it.unibo.arces.wot.sepa.commons.exceptions.SEPAPropertiesException)1 SEPAProtocolException (it.unibo.arces.wot.sepa.commons.exceptions.SEPAProtocolException)1 SEPASecurityException (it.unibo.arces.wot.sepa.commons.exceptions.SEPASecurityException)1 QueryResponse (it.unibo.arces.wot.sepa.commons.response.QueryResponse)1 ARBindingsResults (it.unibo.arces.wot.sepa.commons.sparql.ARBindingsResults)1 BindingsResults (it.unibo.arces.wot.sepa.commons.sparql.BindingsResults)1 ApplicationProfile (it.unibo.arces.wot.sepa.pattern.ApplicationProfile)1 Font (java.awt.Font)1 GridBagConstraints (java.awt.GridBagConstraints)1