@Test public void testGenericNormalization() { MockFactory mock = new MockFactory(BioPAXLevel.L3); Model model = mock.createModel(); Protein[] p = mock.create(model, Protein.class, 3); ProteinReference[] pr = mock.create(model, ProteinReference.class, 2); mock.bindArrays("entityReference", Arrays.copyOfRange(p, 0, 2), pr); mock.bindInPairs("memberPhysicalEntity", p[2],p[0], p[2],p[1]); ModelUtils.normalizeGenerics(model); assertThat(true, is(p[2].getEntityReference()!=null)); assertThat(true, is(p[2].getEntityReference().getMemberEntityReference().contains(pr[0]))); assertThat(true, is(p[2].getEntityReference().getMemberEntityReference().contains(pr[1]))); }
public static void normalizeGenerics(Model model) { final Set<SimplePhysicalEntity> simplePEsToDo = new HashSet<SimplePhysicalEntity>(); for (SimplePhysicalEntity spe : model.getObjects(SimplePhysicalEntity.class)) if (spe.getEntityReference() == null && !spe.getMemberPhysicalEntity().isEmpty()) simplePEsToDo.add(spe); final Map<Set<EntityReference>,EntityReference> memberMap = new HashMap<Set<EntityReference>,EntityReference>(); for (SimplePhysicalEntity pe : simplePEsToDo) { try { createGenericEntityRef(model, pe, memberMap); } catch (Exception e) { LOG.error("createGenericEntityRef failed at " + pe.getUri(), e); } } }
ModelUtils { public static void normalizeGenerics(Model model) { final Set<SimplePhysicalEntity> simplePEsToDo = new HashSet<SimplePhysicalEntity>(); for (SimplePhysicalEntity spe : model.getObjects(SimplePhysicalEntity.class)) if (spe.getEntityReference() == null && !spe.getMemberPhysicalEntity().isEmpty()) simplePEsToDo.add(spe); final Map<Set<EntityReference>,EntityReference> memberMap = new HashMap<Set<EntityReference>,EntityReference>(); for (SimplePhysicalEntity pe : simplePEsToDo) { try { createGenericEntityRef(model, pe, memberMap); } catch (Exception e) { LOG.error("createGenericEntityRef failed at " + pe.getUri(), e); } } } }
ModelUtils { public static void normalizeGenerics(Model model) { final Set<SimplePhysicalEntity> simplePEsToDo = new HashSet<SimplePhysicalEntity>(); for (SimplePhysicalEntity spe : model.getObjects(SimplePhysicalEntity.class)) if (spe.getEntityReference() == null && !spe.getMemberPhysicalEntity().isEmpty()) simplePEsToDo.add(spe); final Map<Set<EntityReference>,EntityReference> memberMap = new HashMap<Set<EntityReference>,EntityReference>(); for (SimplePhysicalEntity pe : simplePEsToDo) { try { createGenericEntityRef(model, pe, memberMap); } catch (Exception e) { LOG.error("createGenericEntityRef failed at " + pe.getUri(), e); } } } ModelUtils(); }
ModelUtils { public static void normalizeGenerics(Model model) { final Set<SimplePhysicalEntity> simplePEsToDo = new HashSet<SimplePhysicalEntity>(); for (SimplePhysicalEntity spe : model.getObjects(SimplePhysicalEntity.class)) if (spe.getEntityReference() == null && !spe.getMemberPhysicalEntity().isEmpty()) simplePEsToDo.add(spe); final Map<Set<EntityReference>,EntityReference> memberMap = new HashMap<Set<EntityReference>,EntityReference>(); for (SimplePhysicalEntity pe : simplePEsToDo) { try { createGenericEntityRef(model, pe, memberMap); } catch (Exception e) { LOG.error("createGenericEntityRef failed at " + pe.getUri(), e); } } } ModelUtils(); static void replace(Model model, final Map<? extends BioPAXElement, ? extends BioPAXElement> subs); static Set<T> getRootElements(final Model model, final Class<T> filterClass); static Set<BioPAXElement> removeObjectsIfDangling(Model model, Class<T> clazz); static Model writeRead(Model model); static Model getDirectChildren(BioPAXElement bpe); static Model getAllChildren(BioPAXElement bpe, 
		@SuppressWarnings("rawtypes") Filter<PropertyEditor>... filters); static Set<BioPAXElement> getDirectChildrenAsSet(BioPAXElement bpe); static Map<Class<? extends BioPAXElement>, Integer> generateClassMetrics(Model model); static T getObject(Model model, String uri, Class<T> clazz); static String md5hex(String id); static void fixDanglingObjectProperties(BioPAXElement bpe, Model model); static void fixDanglingInverseProperties(BioPAXElement bpe, Model model); static Set<EntityFeature> getFeatureIntersection(PhysicalEntity first, FeatureType firstClass,
			PhysicalEntity second, FeatureType secondClass); static Set<EntityFeature> getFeatureSetByType(PhysicalEntity pe, FeatureType type); static boolean checkERFeatureSet(EntityReference er, boolean fix); static Set<EntityFeature> findFeaturesAddedToSecond(PhysicalEntity first, PhysicalEntity second,
			boolean fix); static void fixControlled(Model model, Control control); static void normalizeGeneric(Model model, PhysicalEntity generic); static void normalizeGenerics(Model model); static void addMissingEntityReference(Model model, SimplePhysicalEntity pe); static void replaceEquivalentFeatures(Model model); static Set<String> getKeywords(BioPAXElement biopaxElement, int depth,
										  Filter<DataPropertyEditor>... dataPropertyFilters); static Set<BioSource> getOrganisms(BioPAXElement biopaxElement); static Set<Provenance> getDatasources(BioPAXElement biopaxElement); static Set<Pathway> getParentPathways(BioPAXElement biopaxElement); static void mergeEquivalentInteractions(Model model); static void mergeEquivalentPhysicalEntities(Model model); static String encodeBase62(String str); static String shortenUri(String xmlbase, String uri); static void updateUri(Model model, BioPAXElement el, String newUri); static void breakPathwayComponentCycle(final Model model); static boolean isGeneric(BioPAXElement e); }
ModelUtils { public static void normalizeGenerics(Model model) { final Set<SimplePhysicalEntity> simplePEsToDo = new HashSet<SimplePhysicalEntity>(); for (SimplePhysicalEntity spe : model.getObjects(SimplePhysicalEntity.class)) if (spe.getEntityReference() == null && !spe.getMemberPhysicalEntity().isEmpty()) simplePEsToDo.add(spe); final Map<Set<EntityReference>,EntityReference> memberMap = new HashMap<Set<EntityReference>,EntityReference>(); for (SimplePhysicalEntity pe : simplePEsToDo) { try { createGenericEntityRef(model, pe, memberMap); } catch (Exception e) { LOG.error("createGenericEntityRef failed at " + pe.getUri(), e); } } } ModelUtils(); static void replace(Model model, final Map<? extends BioPAXElement, ? extends BioPAXElement> subs); static Set<T> getRootElements(final Model model, final Class<T> filterClass); static Set<BioPAXElement> removeObjectsIfDangling(Model model, Class<T> clazz); static Model writeRead(Model model); static Model getDirectChildren(BioPAXElement bpe); static Model getAllChildren(BioPAXElement bpe, 
		@SuppressWarnings("rawtypes") Filter<PropertyEditor>... filters); static Set<BioPAXElement> getDirectChildrenAsSet(BioPAXElement bpe); static Map<Class<? extends BioPAXElement>, Integer> generateClassMetrics(Model model); static T getObject(Model model, String uri, Class<T> clazz); static String md5hex(String id); static void fixDanglingObjectProperties(BioPAXElement bpe, Model model); static void fixDanglingInverseProperties(BioPAXElement bpe, Model model); static Set<EntityFeature> getFeatureIntersection(PhysicalEntity first, FeatureType firstClass,
			PhysicalEntity second, FeatureType secondClass); static Set<EntityFeature> getFeatureSetByType(PhysicalEntity pe, FeatureType type); static boolean checkERFeatureSet(EntityReference er, boolean fix); static Set<EntityFeature> findFeaturesAddedToSecond(PhysicalEntity first, PhysicalEntity second,
			boolean fix); static void fixControlled(Model model, Control control); static void normalizeGeneric(Model model, PhysicalEntity generic); static void normalizeGenerics(Model model); static void addMissingEntityReference(Model model, SimplePhysicalEntity pe); static void replaceEquivalentFeatures(Model model); static Set<String> getKeywords(BioPAXElement biopaxElement, int depth,
										  Filter<DataPropertyEditor>... dataPropertyFilters); static Set<BioSource> getOrganisms(BioPAXElement biopaxElement); static Set<Provenance> getDatasources(BioPAXElement biopaxElement); static Set<Pathway> getParentPathways(BioPAXElement biopaxElement); static void mergeEquivalentInteractions(Model model); static void mergeEquivalentPhysicalEntities(Model model); static String encodeBase62(String str); static String shortenUri(String xmlbase, String uri); static void updateUri(Model model, BioPAXElement el, String newUri); static void breakPathwayComponentCycle(final Model model); static boolean isGeneric(BioPAXElement e);  }