use of org.openrefine.wikidata.schema.exceptions.SkipSchemaExpressionException in project OpenRefine by OpenRefine.
the class WbLanguageVariable method fromCell.
@Override
public String fromCell(Cell cell, ExpressionContext ctxt) throws SkipSchemaExpressionException {
if (cell.value != null && !cell.value.toString().isEmpty()) {
String code = cell.value.toString().trim();
String mediaWikiApiEndpoint = ctxt.getMediaWikiApiEndpoint();
String normalized = WbLanguageConstant.normalizeLanguageCode(code, mediaWikiApiEndpoint);
if (normalized != null) {
return normalized;
} else {
QAWarning issue = new QAWarning("ignored-language", null, QAWarning.Severity.WARNING, 1);
issue.setProperty("example_value", cell.value.toString());
ctxt.addWarning(issue);
}
}
throw new SkipSchemaExpressionException();
}
use of org.openrefine.wikidata.schema.exceptions.SkipSchemaExpressionException in project OpenRefine by OpenRefine.
the class WbStatementGroupExpr method evaluate.
public StatementGroupEdit evaluate(ExpressionContext ctxt, EntityIdValue subject) throws SkipSchemaExpressionException {
PropertyIdValue propertyId = propertyExpr.evaluate(ctxt);
List<StatementEdit> statements = new ArrayList<>(statementExprs.size());
for (WbStatementExpr expr : statementExprs) {
try {
statements.add(expr.evaluate(ctxt, subject, propertyId));
} catch (SkipSchemaExpressionException e) {
continue;
}
}
if (!statements.isEmpty()) {
return new StatementGroupEdit(statements);
} else {
throw new SkipSchemaExpressionException();
}
}
Aggregations