@Test public final void testUri() { assertEquals(Normalizer.uri("test/", "foo", "bar", UnificationXref.class), Normalizer.uri("test/", "FOo", "bar", UnificationXref.class)); assertEquals(Normalizer.uri("", "pubchem", "bar", UnificationXref.class), Normalizer.uri("", "PubChem", "bar", UnificationXref.class)); assertEquals(Normalizer.uri("", null, "bar", UnificationXref.class), Normalizer.uri(null, null, "bar", UnificationXref.class)); assertFalse(Normalizer.uri(null, "foo", "bar", UnificationXref.class).equals(Normalizer.uri(null, "foo", "BAR", UnificationXref.class))); assertFalse(Normalizer.uri(null, "foo", "bar", UnificationXref.class).equals(Normalizer.uri(null, "foo", "bar", PublicationXref.class))); assertEquals(Normalizer.uri("test/", "pubmed", "12345", PublicationXref.class), Normalizer.uri("test/", "PubMED", "12345", PublicationXref.class)); assertEquals("http: assertFalse("http: assertEquals("http: assertEquals("http: System.setProperty("biopax.normalizer.uri.strategy", Normalizer.VALUE_NORMALIZER_URI_STRATEGY_SIMPLE); assertEquals("SequenceModificationVocabulary_protein_modification_ontology_MOD_12345",Normalizer.uri("", "PSI-mod", "MOD:12345", SequenceModificationVocabulary.class)); assertEquals("ControlledVocabulary_protein_modification_ontology_MOD_12345",Normalizer.uri("", "MOD", "MOD:12345", ControlledVocabulary.class)); System.setProperty("biopax.normalizer.uri.strategy", Normalizer.VALUE_NORMALIZER_URI_STRATEGY_MD5); assertFalse("http: assertFalse("http: assertEquals("UnificationXref_foo_bar", Normalizer.uri(null, null, "foo bar", UnificationXref.class)); assertEquals("http: assertEquals("http: assertEquals("http: assertNotSame("http: String uri = Normalizer.uri("", "UniProt", "W0C7J9", UnificationXref.class); assertEquals("UnificationXref_uniprot_knowledgebase_W0C7J9", uri); }
public static String uri(final String xmlBase, String dbName, String idPart, Class<? extends BioPAXElement> type) { if(type == null || (dbName == null && idPart == null)) throw new IllegalArgumentException("'Either type' is null, or both dbName and idPart are nulls."); if (idPart != null) idPart = idPart.trim(); if (dbName != null) dbName = dbName.trim(); if (dbName != null) { try { dbName = MiriamLink.getName(dbName); if ((type.equals(PublicationXref.class) && "pubmed".equalsIgnoreCase(dbName)) || type.equals(RelationshipTypeVocabulary.class) || ProteinReference.class.isAssignableFrom(type) || SmallMoleculeReference.class.isAssignableFrom(type) || (type.equals(BioSource.class) && "taxonomy".equalsIgnoreCase(dbName) && idPart!=null && idPart.matches("^\\d+$")) ) { return MiriamLink.getIdentifiersOrgURI(dbName, idPart); } } catch (IllegalArgumentException e) { log.info(String.format("uri(for a %s): db:%s, id:%s are not standard; %s)", type.getSimpleName(), dbName, idPart, e.getMessage())); } } StringBuilder sb = new StringBuilder(); if (dbName != null) sb.append(dbName.toLowerCase()); if (idPart != null) { if (dbName != null) sb.append("_"); sb.append(idPart); } String localPart = sb.toString(); String strategy = System.getProperty(PROPERTY_NORMALIZER_URI_STRATEGY, VALUE_NORMALIZER_URI_STRATEGY_MD5); if(VALUE_NORMALIZER_URI_STRATEGY_SIMPLE.equals(strategy) || Xref.class.isAssignableFrom(type)) { localPart = localPart.replaceAll("[^-\\w]", "_"); } else { localPart = ModelUtils.md5hex(localPart); } return ((xmlBase != null) ? xmlBase : "") + type.getSimpleName() + "_" + localPart; }
Normalizer { public static String uri(final String xmlBase, String dbName, String idPart, Class<? extends BioPAXElement> type) { if(type == null || (dbName == null && idPart == null)) throw new IllegalArgumentException("'Either type' is null, or both dbName and idPart are nulls."); if (idPart != null) idPart = idPart.trim(); if (dbName != null) dbName = dbName.trim(); if (dbName != null) { try { dbName = MiriamLink.getName(dbName); if ((type.equals(PublicationXref.class) && "pubmed".equalsIgnoreCase(dbName)) || type.equals(RelationshipTypeVocabulary.class) || ProteinReference.class.isAssignableFrom(type) || SmallMoleculeReference.class.isAssignableFrom(type) || (type.equals(BioSource.class) && "taxonomy".equalsIgnoreCase(dbName) && idPart!=null && idPart.matches("^\\d+$")) ) { return MiriamLink.getIdentifiersOrgURI(dbName, idPart); } } catch (IllegalArgumentException e) { log.info(String.format("uri(for a %s): db:%s, id:%s are not standard; %s)", type.getSimpleName(), dbName, idPart, e.getMessage())); } } StringBuilder sb = new StringBuilder(); if (dbName != null) sb.append(dbName.toLowerCase()); if (idPart != null) { if (dbName != null) sb.append("_"); sb.append(idPart); } String localPart = sb.toString(); String strategy = System.getProperty(PROPERTY_NORMALIZER_URI_STRATEGY, VALUE_NORMALIZER_URI_STRATEGY_MD5); if(VALUE_NORMALIZER_URI_STRATEGY_SIMPLE.equals(strategy) || Xref.class.isAssignableFrom(type)) { localPart = localPart.replaceAll("[^-\\w]", "_"); } else { localPart = ModelUtils.md5hex(localPart); } return ((xmlBase != null) ? xmlBase : "") + type.getSimpleName() + "_" + localPart; } }
Normalizer { public static String uri(final String xmlBase, String dbName, String idPart, Class<? extends BioPAXElement> type) { if(type == null || (dbName == null && idPart == null)) throw new IllegalArgumentException("'Either type' is null, or both dbName and idPart are nulls."); if (idPart != null) idPart = idPart.trim(); if (dbName != null) dbName = dbName.trim(); if (dbName != null) { try { dbName = MiriamLink.getName(dbName); if ((type.equals(PublicationXref.class) && "pubmed".equalsIgnoreCase(dbName)) || type.equals(RelationshipTypeVocabulary.class) || ProteinReference.class.isAssignableFrom(type) || SmallMoleculeReference.class.isAssignableFrom(type) || (type.equals(BioSource.class) && "taxonomy".equalsIgnoreCase(dbName) && idPart!=null && idPart.matches("^\\d+$")) ) { return MiriamLink.getIdentifiersOrgURI(dbName, idPart); } } catch (IllegalArgumentException e) { log.info(String.format("uri(for a %s): db:%s, id:%s are not standard; %s)", type.getSimpleName(), dbName, idPart, e.getMessage())); } } StringBuilder sb = new StringBuilder(); if (dbName != null) sb.append(dbName.toLowerCase()); if (idPart != null) { if (dbName != null) sb.append("_"); sb.append(idPart); } String localPart = sb.toString(); String strategy = System.getProperty(PROPERTY_NORMALIZER_URI_STRATEGY, VALUE_NORMALIZER_URI_STRATEGY_MD5); if(VALUE_NORMALIZER_URI_STRATEGY_SIMPLE.equals(strategy) || Xref.class.isAssignableFrom(type)) { localPart = localPart.replaceAll("[^-\\w]", "_"); } else { localPart = ModelUtils.md5hex(localPart); } return ((xmlBase != null) ? xmlBase : "") + type.getSimpleName() + "_" + localPart; } Normalizer(); }
Normalizer { public static String uri(final String xmlBase, String dbName, String idPart, Class<? extends BioPAXElement> type) { if(type == null || (dbName == null && idPart == null)) throw new IllegalArgumentException("'Either type' is null, or both dbName and idPart are nulls."); if (idPart != null) idPart = idPart.trim(); if (dbName != null) dbName = dbName.trim(); if (dbName != null) { try { dbName = MiriamLink.getName(dbName); if ((type.equals(PublicationXref.class) && "pubmed".equalsIgnoreCase(dbName)) || type.equals(RelationshipTypeVocabulary.class) || ProteinReference.class.isAssignableFrom(type) || SmallMoleculeReference.class.isAssignableFrom(type) || (type.equals(BioSource.class) && "taxonomy".equalsIgnoreCase(dbName) && idPart!=null && idPart.matches("^\\d+$")) ) { return MiriamLink.getIdentifiersOrgURI(dbName, idPart); } } catch (IllegalArgumentException e) { log.info(String.format("uri(for a %s): db:%s, id:%s are not standard; %s)", type.getSimpleName(), dbName, idPart, e.getMessage())); } } StringBuilder sb = new StringBuilder(); if (dbName != null) sb.append(dbName.toLowerCase()); if (idPart != null) { if (dbName != null) sb.append("_"); sb.append(idPart); } String localPart = sb.toString(); String strategy = System.getProperty(PROPERTY_NORMALIZER_URI_STRATEGY, VALUE_NORMALIZER_URI_STRATEGY_MD5); if(VALUE_NORMALIZER_URI_STRATEGY_SIMPLE.equals(strategy) || Xref.class.isAssignableFrom(type)) { localPart = localPart.replaceAll("[^-\\w]", "_"); } else { localPart = ModelUtils.md5hex(localPart); } return ((xmlBase != null) ? xmlBase : "") + type.getSimpleName() + "_" + localPart; } Normalizer(); String normalize(String biopaxOwlData); static String uri(final String xmlBase, 
		String dbName, String idPart, Class<? extends BioPAXElement> type); String getDescription(); void setDescription(String description); void normalize(Model model); static void autoName(Provenance pro); static String convertToLevel3(final String biopaxData); boolean isFixDisplayName(); void setFixDisplayName(boolean fixDisplayName); String getXmlBase(); void setXmlBase(String xmlBase); }
Normalizer { public static String uri(final String xmlBase, String dbName, String idPart, Class<? extends BioPAXElement> type) { if(type == null || (dbName == null && idPart == null)) throw new IllegalArgumentException("'Either type' is null, or both dbName and idPart are nulls."); if (idPart != null) idPart = idPart.trim(); if (dbName != null) dbName = dbName.trim(); if (dbName != null) { try { dbName = MiriamLink.getName(dbName); if ((type.equals(PublicationXref.class) && "pubmed".equalsIgnoreCase(dbName)) || type.equals(RelationshipTypeVocabulary.class) || ProteinReference.class.isAssignableFrom(type) || SmallMoleculeReference.class.isAssignableFrom(type) || (type.equals(BioSource.class) && "taxonomy".equalsIgnoreCase(dbName) && idPart!=null && idPart.matches("^\\d+$")) ) { return MiriamLink.getIdentifiersOrgURI(dbName, idPart); } } catch (IllegalArgumentException e) { log.info(String.format("uri(for a %s): db:%s, id:%s are not standard; %s)", type.getSimpleName(), dbName, idPart, e.getMessage())); } } StringBuilder sb = new StringBuilder(); if (dbName != null) sb.append(dbName.toLowerCase()); if (idPart != null) { if (dbName != null) sb.append("_"); sb.append(idPart); } String localPart = sb.toString(); String strategy = System.getProperty(PROPERTY_NORMALIZER_URI_STRATEGY, VALUE_NORMALIZER_URI_STRATEGY_MD5); if(VALUE_NORMALIZER_URI_STRATEGY_SIMPLE.equals(strategy) || Xref.class.isAssignableFrom(type)) { localPart = localPart.replaceAll("[^-\\w]", "_"); } else { localPart = ModelUtils.md5hex(localPart); } return ((xmlBase != null) ? xmlBase : "") + type.getSimpleName() + "_" + localPart; } Normalizer(); String normalize(String biopaxOwlData); static String uri(final String xmlBase, 
		String dbName, String idPart, Class<? extends BioPAXElement> type); String getDescription(); void setDescription(String description); void normalize(Model model); static void autoName(Provenance pro); static String convertToLevel3(final String biopaxData); boolean isFixDisplayName(); void setFixDisplayName(boolean fixDisplayName); String getXmlBase(); void setXmlBase(String xmlBase); static final String PROPERTY_NORMALIZER_URI_STRATEGY; static final String VALUE_NORMALIZER_URI_STRATEGY_SIMPLE; static final String VALUE_NORMALIZER_URI_STRATEGY_MD5; }