Generates the blacklist.
@param model model to use
@return the blacklist
@throws IOException when there is an I/O problem
14286
public Blacklist generateBlacklist(Model model) throws IOException
	{
		Map<String, String> nameMapping = readNameMapping();
		if (nameMapping == null)
		{
			generateNameMappingFileToCurate(model);
			throw new RuntimeException("Small molecule name mapping file not found. Generated a " +
				"mapping file, but it needs manual curation before use.\nPlease go over some top " +
				"portion of this file and delete invalid lines and any uncurated bottom part.\n" +
				"After that, you can rerun this method.");
		}

		SIFSearcher searcher = new SIFSearcher(new Fetcher(nameMapping), SIFEnum.USED_TO_PRODUCE);

		Set<SIFInteraction> sifs = searcher.searchSIF(model);

		// read interactions into maps

		Map<String, Set<String>> upstrMap = new HashMap<String, Set<String>>();
		Map<String, Set<String>> dwstrMap = new HashMap<String, Set<String>>();
		final Map<String, Set<String>> neighMap = new HashMap<String, Set<String>>();

		for (SIFInteraction sif : sifs)
		{
			String source = sif.sourceID;
			String target = sif.targetID;

			if (!neighMap.containsKey(source)) neighMap.put(source, new HashSet<String>());
			if (!neighMap.containsKey(target)) neighMap.put(target, new HashSet<String>());
			if (!dwstrMap.containsKey(source)) dwstrMap.put(source, new HashSet<String>());
			if (!dwstrMap.containsKey(target)) dwstrMap.put(target, new HashSet<String>());
			if (!upstrMap.containsKey(source)) upstrMap.put(source, new HashSet<String>());
			if (!upstrMap.containsKey(target)) upstrMap.put(target, new HashSet<String>());

			neighMap.get(source).add(target);
			neighMap.get(target).add(source);
			dwstrMap.get(source).add(target);
			upstrMap.get(target).add(source);
		}

		// remove intersection of upstream and downstream

		for (String name : neighMap.keySet())
		{
			if (!upstrMap.containsKey(name) || !dwstrMap.containsKey(name)) continue;

			Set<String> upstr = upstrMap.get(name);
			Set<String> dwstr = dwstrMap.get(name);

			Set<String> temp = new HashSet<String>(upstr);
			upstr.removeAll(dwstr);
			dwstr.removeAll(temp);
		}

//		writeTheGuideRankingToTuneTheDecider(model, nameMapping, upstrMap, dwstrMap, neighMap);
//		if (true) return null;

		Set<String> white = readWhitelist();

		Blacklist blacklist = new Blacklist();

		// populate the blacklist

		Fetcher nameFetcher = new Fetcher(nameMapping);
		for (SmallMoleculeReference smr : model.getObjects(SmallMoleculeReference.class))
		{
			Set<String> names = nameFetcher.fetchID(smr);
			if (names.isEmpty()) continue;
			String name = names.iterator().next();

			if (white != null && white.contains(name)) continue;

			int neighSize = neighMap.containsKey(name) ? neighMap.get(name).size() : 0;
			int upstrOnly = upstrMap.containsKey(name) ? upstrMap.get(name).size() : 0;
			int dwstrOnly = dwstrMap.containsKey(name) ? dwstrMap.get(name).size() : 0;

			if (decider.isUbique(neighSize, upstrOnly, dwstrOnly))
			{
				blacklist.addEntry(smr.getUri(),
					decider.getScore(neighSize, upstrOnly, dwstrOnly),
					decider.getContext(neighSize, upstrOnly, dwstrOnly));
			}
		}

		return blacklist;
	}
942175
public void loadModel(String modelfile) throws IOException,
			ClassNotFoundException {
		ObjectInputStream instream = new ObjectInputStream(new GZIPInputStream(
				new FileInputStream(modelfile)));
		factory = (AlphabetFactory) instream.readObject();
		models = (Linear[]) instream.readObject();
		instream.close();
		IFeatureAlphabet features = factory.DefaultFeatureAlphabet();
		features.setStopIncrement(true);
	}
143946
private void blacklist(String nodeName, ResourceType type) {
    List<ResourceType> blacklistedResourceTypes =
      blacklistedNodes.get(nodeName);
    if (blacklistedResourceTypes == null) {
      blacklistedResourceTypes = new ArrayList<ResourceType>();
      blacklistedNodes.put(nodeName, blacklistedResourceTypes);
    }
    synchronized (blacklistedResourceTypes) {
      if (!blacklistedResourceTypes.contains(type)) {
        blacklistedResourceTypes.add(type);
      }
    }
  }
453065
protected String getErrorCodeFrom(final Map<String, Object> model) {
        return model.get(CasViewConstants.MODEL_ATTRIBUTE_NAME_ERROR_CODE).toString();
    }
282798
protected final FluentModelTImpl prepareInlineDefine(FluentModelTImpl model) {
        FluentModelTImpl childResource = find(model.childResourceKey());
        if (childResource != null) {
            throw new IllegalArgumentException(pendingOperationMessage(model.name(), model.childResourceKey()));
        }
        model.setPendingOperation(ExternalChildResourceImpl.PendingOperation.ToBeCreated);
        this.childCollection.put(model.childResourceKey(), model);
        return super.prepareForFutureCommitOrPostRun(model);
    }
1274828
private Id createMethodConsumerId(RpcClientLookoutModel model) {

        Map<String, String> tags = new HashMap<String, String>(6);

        tags.put("app", StringUtils.defaultString(model.getApp()));
        tags.put("service", StringUtils.defaultString(model.getService()));
        tags.put("method", StringUtils.defaultString(model.getMethod()));
        tags.put("protocol", StringUtils.defaultString(model.getProtocol()));
        tags.put("invoke_type", StringUtils.defaultString(model.getInvokeType()));
        tags.put("target_app", StringUtils.defaultString(model.getTargetApp()));

        return rpcLookoutId.fetchConsumerStatId().withTags(tags);
    }
187797
public Model filter(Model model) {
		if(model == null || model.getLevel() != BioPAXLevel.L2)
			return model; // nothing to do

		preparePep2PEIDMap(model);

		final Model newModel = factory.createModel();
		newModel.getNameSpacePrefixMap().putAll(model.getNameSpacePrefixMap());
		newModel.setXmlBase(model.getXmlBase());
		
		// facilitate the conversion
		normalize(model);
		
		// First, map classes (and only set ID) if possible (pre-processing)
		for(BioPAXElement bpe : model.getObjects()) {
			Level3Element l3element = mapClass(bpe);
			if(l3element != null) {
				newModel.add(l3element);
			} else {
				log.debug("Skipping " + bpe + " " + bpe.getModelInterface().getSimpleName());
			}
		}
		
		/* process each L2 element (mapping properties), 
		 * except for pEPs and oCVs that must be processed as values
		 * (anyway, we do not want dangling elements)
		 */
		for(BioPAXElement e : model.getObjects()) {
			if(e instanceof physicalEntityParticipant
				|| e instanceof openControlledVocabulary) {
				continue;
			}
			
			// map properties
			traverse((Level2Element) e, newModel);
		}

		log.info("Done: new L3 model contains " + newModel.getObjects().size() + " BioPAX individuals.");
		
		// fix new model (e.g., add PathwayStep's processes to the pathway components ;))
		normalize(newModel);
		
		return newModel;
	}
141048
public void removeFilterModel(final FilterModel model) {
		if (model.getUrlPatterns() != null) {
			try {
				deassociateBundle(model.getContextModel().getVirtualHosts(), model.getContextModel().getBundle());
				filterLock.writeLock().lock();
				for (String virtualHost:resolveVirtualHosts(model)) {
					for (String urlPattern : model.getUrlPatterns()) {
							String fullPath = getFullPath(model.getContextModel(), urlPattern);
							Set<UrlPattern> urlSet = filterUrlPatterns.get(virtualHost).get(fullPath);
							UrlPattern toDelete = null;
							for (UrlPattern pattern : urlSet) {
									FilterModel filterModel = (FilterModel) pattern.getModel();
									Class<?> filter = filterModel.getFilterClass();
									Class<?> matchFilter = model.getFilterClass();
									if (filter != null && filter.equals(matchFilter)) {
											toDelete = pattern;
											break;
									}
							}
							urlSet.remove(toDelete);
					}
				}
			} finally {
				filterLock.writeLock().unlock();
			}
		}
	}
912097
def _create_model_class(self, model):
        
        cls_name = model.replace('.', '_')
        # Hack for Python 2 (no need to do this for Python 3)
        if sys.version_info[0] < 3:
            if isinstance(cls_name, unicode):
                cls_name = cls_name.encode('utf-8')
        # Retrieve server fields info and generate corresponding local fields
        attrs = {
            '_env': self,
            '_odoo': self._odoo,
            '_name': model,
            '_columns': {},
        }
        fields_get = self._odoo.execute(model, 'fields_get')
        for field_name, field_data in fields_get.items():
            if field_name not in FIELDS_RESERVED:
                Field = fields.generate_field(field_name, field_data)
                attrs['_columns'][field_name] = Field
                attrs[field_name] = Field
        # Case where no field 'name' exists, we generate one (which will be
        # in readonly mode) in purpose to be filled with the 'name_get' method
        if 'name' not in attrs['_columns']:
            field_data = {'type': 'text', 'string': 'Name', 'readonly': True}
            Field = fields.generate_field('name', field_data)
            attrs['_columns']['name'] = Field
            attrs['name'] = Field
        return type(cls_name, (Model,), attrs)
338272
public static RdfStream fromModel(final Node node, final Model model) {
        return new DefaultRdfStream(node,
                stream(spliteratorUnknownSize(model.listStatements(), IMMUTABLE), false).map(Statement::asTriple));
    }
1353971
public void addFilterModel(final FilterModel model) {
		if (model.getUrlPatterns() != null) {
			try {
				filterLock.writeLock().lock();
				associateBundle(model.getContextModel().getVirtualHosts(), model.getContextModel().getBundle());
				for (String virtualHost : resolveVirtualHosts(model)) {
					for (String urlPattern : model.getUrlPatterns()) {
							final UrlPattern newUrlPattern = new UrlPattern(getFullPath(model.getContextModel(), urlPattern),
											model);
							String fullPath = getFullPath(model.getContextModel(), urlPattern);
							if (filterUrlPatterns.get(virtualHost) == null) {
								filterUrlPatterns.put(virtualHost, new ConcurrentHashMap<>());
							}
							Set<UrlPattern> urlSet = filterUrlPatterns.get(virtualHost).get(fullPath);
							if (urlSet == null) {
									//initialize first
									urlSet = new HashSet<>();
							}
							urlSet.add(newUrlPattern);
							filterUrlPatterns.get(virtualHost).put(fullPath, urlSet);
    //					final UrlPattern existingPattern = filterUrlPatterns.putIfAbsent(
    //							getFullPath(model.getContextModel(), urlPattern), newUrlPattern);
    //					if (existingPattern != null) {
    //						// this should never happen but is a good assertion
    //						LOG.error("Internal error (please report): Cannot associate url mapping "
    //								+ getFullPath(model.getContextModel(), urlPattern) + " to " + newUrlPattern
    //								+ " because is already associated to " + existingPattern);
    //					}
                                    }
                                }
			} finally {
				filterLock.writeLock().unlock();
			}
		}
	}
154393
public Id createMethodProviderId(RpcServerLookoutModel model) {
        Map<String, String> tags = new HashMap<String, String>(5);

        tags.put("app", StringUtils.defaultString(model.getApp()));
        tags.put("service", StringUtils.defaultString(model.getService()));
        tags.put("method", StringUtils.defaultString(model.getMethod()));
        tags.put("protocol", StringUtils.defaultString(model.getProtocol()));
        tags.put("caller_app", StringUtils.defaultString(model.getCallerApp()));

        return rpcLookoutId.fetchProviderStatId().withTags(tags);
    }
109613
public AdjacencyMatrix searchSIFGetMatrix(Model model)
	{
		Set<SIFInteraction> sifInts = searchSIF(model);
		return new AdjacencyMatrix(
			SIFInteraction.convertToAdjacencyMatrix(sifInts),
			SIFInteraction.getSortedGeneNames(sifInts));
	}
15214
private ODocument getOrCreateModel(String model) {
        ODocument node = getModel(model);
        if (node == null) {
            node = graph.createVertex("Models");
            OrientModelGraphUtils.setIdFieldValue(node, model.toString());
            OrientModelGraphUtils.setActiveFieldValue(node, false);
            node.save();
        }
        return node;
    }
973081
@RequestMapping(value = "/api/profile", method = RequestMethod.GET)
    public
    @ResponseBody
    HashMap<String, Object> getList(Model model) throws Exception {
        logger.info("Using a GET request to list profiles");
        return Utils.getJQGridJSON(profileService.findAllProfiles(), "profiles");
    }
961560
public void addControls( final Model model )
    {
        final URIBuilder pagedURL;
        try {
            pagedURL = new URIBuilder( fragmentURL );
        }
        catch ( URISyntaxException e ) {
            throw new IllegalArgumentException( e );
        }

        final Resource fragmentId = model.createResource( fragmentURL );

        final Resource firstPageId =
                model.createResource(
                        pagedURL.setParameter(ILinkedDataFragmentRequest.PARAMETERNAME_PAGE,
                                              "1").toString() );

        fragmentId.addProperty( CommonResources.HYDRA_FIRSTPAGE, firstPageId );

        if ( pageNumber > 1) {
            final String prevPageNumber = Long.toString( pageNumber - 1 );
            final Resource prevPageId =
                    model.createResource(
                            pagedURL.setParameter(ILinkedDataFragmentRequest.PARAMETERNAME_PAGE,
                                                  prevPageNumber).toString() );

            fragmentId.addProperty( CommonResources.HYDRA_PREVIOUSPAGE, prevPageId );
        }

        if ( ! isLastPage ) {
            final String nextPageNumber = Long.toString( pageNumber + 1 );
            final Resource nextPageId =
                    model.createResource(
                            pagedURL.setParameter(ILinkedDataFragmentRequest.PARAMETERNAME_PAGE,
                                                  nextPageNumber).toString() );

            fragmentId.addProperty( CommonResources.HYDRA_NEXTPAGE, nextPageId );
        }
    }
430992
private static void writeModelJAR(String outPath) throws IOException {
    Preconditions.checkArgument(
        outPath.endsWith(MODEL_JAR_SUFFIX), "invalid model file path! " + outPath);
    ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(outPath));
    if (!map_result.isEmpty()) {
      ZipEntry entry = new ZipEntry(DEFAULT_ASTUBX_LOCATION);
      // Set the modification/creation time to 0 to ensure that this jars always have the same
      // checksum
      entry.setTime(0);
      entry.setCreationTime(FileTime.fromMillis(0));
      zos.putNextEntry(entry);
      writeModel(new DataOutputStream(zos));
      zos.closeEntry();
    }
    zos.close();
    LOG(VERBOSE, "Info", "wrote model to: " + outPath);
  }