use of it.unibo.arces.wot.sepa.commons.exceptions.SEPABindingsException in project SEPA by arces-wot.
the class Bindings method getRDFTerm.
public RDFTerm getRDFTerm(String variable) throws SEPABindingsException {
if (!solution.has(variable))
throw new SEPABindingsException(String.format("Variable not found: %s", variable));
try {
String type = getType(variable);
String value = getValue(variable);
switch(type) {
case "uri":
return new RDFTermURI(value);
case "literal":
case "typed-literal":
if (getDatatype(variable) == null)
return new RDFTermLiteral(value);
return new RDFTermLiteral(value, getDatatype(variable));
case "bnode":
return new RDFTermBNode(value);
}
} catch (Exception e) {
throw new SEPABindingsException(e);
}
return null;
}
use of it.unibo.arces.wot.sepa.commons.exceptions.SEPABindingsException in project SEPA by arces-wot.
the class ITPattern method genericClientSingleSubscribe.
@RepeatedTest(ConfigurationProvider.REPEATED_TEST)
@Timeout(10)
public void genericClientSingleSubscribe() {
try {
genericClient = new GenericClient(provider.getJsap(), handler);
genericClient.subscribe("ALL", null, "first", provider.TIMEOUT, provider.NRETRY);
handler.waitSubscribes(1);
Response ret = genericClient.update("RANDOM", null, provider.TIMEOUT, provider.NRETRY);
assertFalse(ret.isError(), ret.toString());
handler.waitEvents(2);
genericClient.unsubscribe(handler.getSpuid("first"), provider.TIMEOUT, provider.NRETRY);
handler.waitUnsubscribes(1);
} catch (SEPAProtocolException | SEPASecurityException | SEPAPropertiesException | SEPABindingsException | InterruptedException | IOException e) {
e.printStackTrace();
assertFalse(true, e.getMessage());
}
}
Aggregations