@Override protected void processInput(String keggGeneId, String keggGeneRecord, Resource output) { Map<String, String> recordSections = KeggUtils.getSectionsFromKeggRecord(keggGeneRecord); StrTokenizer tokenizer = new StrTokenizer(); if (recordSections.containsKey(PATHWAY_RECORD_SECTION)) { for (String line : recordSections.get(PATHWAY_RECORD_SECTION).split("\\r?\\n")) { String keggPathwayId = tokenizer.reset(line).nextToken(); Resource keggPathwayNode = LSRNUtils.createInstance( output.getModel(), LSRNUtils.getClass(LSRN.Namespace.KEGG_PATHWAY), keggPathwayId); output.addProperty(SIO.is_participant_in, keggPathwayNode); } } }
/** * Converts a String back to connection parameters. * * @param input String from configuration * @return JDBC connection parameters */ protected static Properties propertiesFromString(String input) { if (input != null && !input.isEmpty()) { Properties result = new Properties(); StrTokenizer propertyTokenizer = StrTokenizer.getCSVInstance(input); StrTokenizer valueTokenizer = StrTokenizer.getCSVInstance(); valueTokenizer.setDelimiterChar('='); while (propertyTokenizer.hasNext()) { valueTokenizer.reset(propertyTokenizer.nextToken()); String[] values = valueTokenizer.getTokenArray(); if (values.length == 2) { result.put(values[0], values[1]); } } return result; } else { return null; } }