private Optional<List<Snak>> processGDMQualifiedAttributes(final Statement statement) { final List<Snak> snakList = new ArrayList<>(); final Optional<Snak> optionalConfidence = processGDMQualifiedAttribute( CONFIDENCE_QUALIFIED_ATTRIBUTE_IDENTIFIER, statement.getConfidence()); final Optional<Snak> optionalEvidence = processGDMQualifiedAttribute( EVIDENCE_QUALIFIED_ATTRIBUTE_IDENTIFIER, statement.getEvidence()); final Optional<Snak> optionalOrder = processGDMQualifiedAttribute(ORDER_QUALIFIED_ATTRIBUTE_IDENTIFIER, statement.getOrder()); // D:SWARM statement uuid final Optional<Snak> optionalUUID = processGDMQualifiedAttribute( STATEMENT_UUID_QUALIFIED_ATTRIBUTE_IDENTIFIER, statement.getUUID()); addToSnakList(optionalConfidence, snakList); addToSnakList(optionalEvidence, snakList); addToSnakList(optionalOrder, snakList); addToSnakList(optionalUUID, snakList); if (snakList.isEmpty()) { return Optional.empty(); } return Optional.of(snakList); }
private static String printGDMStatement(final Statement statement) { final StringBuilder sb = new StringBuilder(); final Long id = statement.getId(); sb.append("{statement: id ='"); if (id != null) { sb.append(id); } else { sb.append("no statement id available"); } sb.append("' :: "); final String uuid = statement.getUUID(); sb.append("uuid = '"); if (uuid != null) { sb.append(uuid); } else { sb.append("no uuid available"); } sb.append("' :: "); final String subject = printGDMNode(statement.getSubject()); sb.append("subject = '").append(subject).append("' :: "); final String predicateURI = statement.getPredicate().getUri(); sb.append("predicate = '").append(predicateURI).append("' :: "); final String object = printGDMNode(statement.getObject()); sb.append("object = '").append(object).append("'}"); return sb.toString(); }