private static String buildMessage(List<Indicator> indicators) { StringBuilder sb = new StringBuilder(); if (!indicators.isEmpty()) { sb.append("\n"); sb.append("The plugin cannot load the OBDA model. (REASON: Unknown predicate declarations)\n"); sb.append("Please make sure the following predicates match to the source ontology.\n\n"); for (Indicator indicator : indicators) { int lineNumber = indicator.getLineNumber(); int columnNumber = indicator.getColumnNumber(); Predicate predicate = (Predicate) indicator.getHint(); switch (indicator.getReason()) { case UNKNOWN_PREDICATE: if (predicate.isClass()) { sb.append(String.format("Line %d, Column %d: %s (unknown class)\n", lineNumber, columnNumber, predicate.getName())); } else if (predicate.isObjectProperty()) { sb.append(String.format("Line %d, Column %d: %s (unknown object property)\n", lineNumber, columnNumber, predicate.getName())); } else if (predicate.isDataProperty()) { sb.append(String.format("Line %d, Column %d: %s (unknown data property)\n", lineNumber, columnNumber, predicate.getName())); } break; // case break } } } return sb.toString(); } }
sb.append("Please fix the following mappings and reload the file.\n\n"); for (Indicator indicator : indicators) { int lineNumber = indicator.getLineNumber(); String mappingId = ""; switch (indicator.getReason()) { case MAPPING_ID_IS_BLANK: sb.append(String.format("Line %d: Invalid input: (mappingId = null)\n\n", lineNumber)); break; case TARGET_QUERY_IS_BLANK: mappingId = (String) indicator.getHint(); if (!mappingId.isEmpty()) { sb.append(String.format("MappingId = '%s'\n", mappingId)); break; case SOURCE_QUERY_IS_BLANK: mappingId = (String) indicator.getHint(); if (!mappingId.isEmpty()) { sb.append(String.format("MappingId = '%s'\n", mappingId)); break; case UNKNOWN_PREDICATE_IN_TARGET_QUERY: Object[] hints1 = (Object[]) indicator.getHint(); mappingId = (String) hints1[0]; if (!mappingId.isEmpty()) { break; case ERROR_PARSING_TARGET_QUERY: String[] hints2 = (String[]) indicator.getHint();
mappingId = value; if (mappingId.isEmpty()) { // empty or not invalidMappingIndicators.add(new Indicator(lineNumber, Label.mappingId, MAPPING_ID_IS_BLANK)); isMappingValid = false; String targetString = value; if (targetString.isEmpty()) { // empty or not invalidMappingIndicators.add(new Indicator(lineNumber, mappingId, TARGET_QUERY_IS_BLANK)); isMappingValid = false; } else { targetQuery = loadTargetQuery(targetString, parsers); } catch (UnparsableTargetQueryException e) { invalidMappingIndicators.add(new Indicator(lineNumber, new String[] {mappingId, targetString, e.getMessage()}, ERROR_PARSING_TARGET_QUERY)); isMappingValid = false; String sourceString = value; if (sourceString.isEmpty()) { // empty or not invalidMappingIndicators.add(new Indicator(lineNumber, mappingId, SOURCE_QUERY_IS_BLANK)); isMappingValid = false; } else {
sb.append("The syntax of the mapping is invalid (and therefore cannot be processed). Problems: \n\n"); for (Indicator indicator : indicators) { int lineNumber = indicator.getLineNumber(); String mappingId = ""; switch (indicator.getReason()) { case MAPPING_ID_IS_BLANK: sb.append(String.format("Line %d: Mapping ID is missing\n\n", lineNumber)); break; case TARGET_QUERY_IS_BLANK: mappingId = (String) indicator.getHint(); if (!mappingId.isEmpty()) { sb.append(String.format("MappingId = '%s'\n", mappingId)); break; case SOURCE_QUERY_IS_BLANK: mappingId = (String) indicator.getHint(); if (!mappingId.isEmpty()) { sb.append(String.format("MappingId = '%s'\n", mappingId)); break; case UNKNOWN_PREDICATE_IN_TARGET_QUERY: Object[] hints1 = (Object[]) indicator.getHint(); mappingId = (String) hints1[0]; if (!mappingId.isEmpty()) { break; case ERROR_PARSING_TARGET_QUERY: String[] hints2 = (String[]) indicator.getHint();
mappingId = value; if (mappingId.isEmpty()) { // empty or not register(invalidMappingIndicators, new Indicator(lineNumber, Label.mappingId, InvalidMappingException.MAPPING_ID_IS_BLANK)); isMappingValid = false; String targetString = value; if (targetString.isEmpty()) { // empty or not register(invalidMappingIndicators, new Indicator(lineNumber, mappingId, InvalidMappingException.TARGET_QUERY_IS_BLANK)); isMappingValid = false; } else { String sourceString = value; if (sourceString.isEmpty()) { // empty or not register(invalidMappingIndicators, new Indicator(lineNumber, mappingId, InvalidMappingException.SOURCE_QUERY_IS_BLANK)); isMappingValid = false; } else {
@Override public String getMessage() { StringBuilder sb = new StringBuilder(); if (!indicators.isEmpty()) { sb.append("\n"); sb.append("The plugin cannot load the OBDA model. (REASON: Unknown predicate declarations)\n"); sb.append("Please make sure the following predicates match to the source ontology.\n\n"); for (Indicator indicator : indicators) { int lineNumber = indicator.getLineNumber(); int columnNumber = indicator.getColumnNumber(); Predicate predicate = (Predicate) indicator.getHint(); switch (indicator.getReason()) { case UNKNOWN_PREDICATE: if (predicate.isClass()) { sb.append(String.format("Line %d, Column %d: %s (unknown class)\n", lineNumber, columnNumber, predicate.getName())); } else if (predicate.isObjectProperty()) { sb.append(String.format("Line %d, Column %d: %s (unknown object property)\n", lineNumber, columnNumber, predicate.getName())); } else if (predicate.isDataProperty()) { sb.append(String.format("Line %d, Column %d: %s (unknown data property)\n", lineNumber, columnNumber, predicate.getName())); } break; // case break } } } String message = sb.toString(); return message; } }
sb.append("The syntax of the mapping is invalid (and therefore cannot be processed). Problems: \n\n"); for (Indicator indicator : indicators) { int lineNumber = indicator.getLineNumber(); String mappingId = ""; switch (indicator.getReason()) { case MAPPING_ID_IS_BLANK: sb.append(String.format("Line %d: Mapping ID is missing\n\n", lineNumber)); break; case TARGET_QUERY_IS_BLANK: mappingId = (String) indicator.getHint(); if (!mappingId.isEmpty()) { sb.append(String.format("MappingId = '%s'\n", mappingId)); break; case SOURCE_QUERY_IS_BLANK: mappingId = (String) indicator.getHint(); if (!mappingId.isEmpty()) { sb.append(String.format("MappingId = '%s'\n", mappingId)); break; case UNKNOWN_PREDICATE_IN_TARGET_QUERY: Object[] hints1 = (Object[]) indicator.getHint(); mappingId = (String) hints1[0]; if (!mappingId.isEmpty()) { break; case ERROR_PARSING_TARGET_QUERY: String[] hints2 = (String[]) indicator.getHint();