use of de.ids_mannheim.korap.query.wrap.SpanRelationWrapper in project Krill by KorAP.
the class KrillQuery method _operationRelationFromJson.
private SpanQueryWrapper _operationRelationFromJson(JsonNode operands, JsonNode relation) throws QueryException {
if (operands.size() < 2) {
throw new QueryException(705, "Number of operands is not acceptable");
}
SpanQueryWrapper operand1 = this._fromKoral(operands.get(0), true);
SpanQueryWrapper operand2 = this._fromKoral(operands.get(1), true);
RelationDirection direction;
if (operand1.isEmpty() && !operand2.isEmpty()) {
// "<:";
direction = RelationDirection.LEFT;
} else {
// ">:"
direction = RelationDirection.RIGHT;
}
if (!relation.has("@type")) {
throw new QueryException(701, "JSON-LD group has no @type attribute");
}
if (relation.get("@type").asText().equals("koral:relation")) {
SpanRelationWrapper spanRelationWrapper;
SpanQueryWrapper relationTermWrapper;
if (!relation.has("wrap")) {
throw new QueryException(718, "Missing relation term.");
} else {
relationTermWrapper = _termFromJson(relation.get("wrap"), false, direction);
spanRelationWrapper = new SpanRelationWrapper(relationTermWrapper, operand1, operand2);
}
spanRelationWrapper.setDirection(direction);
return spanRelationWrapper;
} else {
throw new QueryException(713, "Query type is not supported");
}
// if (relation.has("boundary")){
// _operationRepetitionFromJson(relation, operands);
// }
// else{
//
// }
}
Aggregations