Generates example queries for all imported corpora.

@param overwrite Deletes already exisiting example queries.
176019
public void generateQueries(Boolean overwrite)
  {
    List<AnnisCorpus> corpora = queryDao.listCorpora();
    for (AnnisCorpus annisCorpus : corpora)
    {
      generateQueries(annisCorpus.getId(), overwrite);
    }
  }
5007
@Override
  public MtasSpanQuery rewrite(IndexReader reader) throws IOException {
    MtasSpanQuery newQ1 = (MtasSpanQuery) q1.rewrite(reader);
    MtasSpanQuery newQ2 = (MtasSpanQuery) q2.rewrite(reader);
    if (!newQ1.equals(q1) || !newQ2.equals(q2)) {
      return new MtasSpanNotQuery(newQ1, newQ2).rewrite(reader);
    } else {
      baseQuery = (SpanNotQuery) baseQuery.rewrite(reader);
      return super.rewrite(reader);
    }
  }
91451
public static WriteOptions writeOptions(Boolean overwrite, Boolean forceSync){
    WriteOptions wo = new WriteOptions();
    if (overwrite != null)
      wo.setOverwrite(overwrite);
    if (forceSync != null)
      wo.setForcesync(forceSync);
    return wo;
  }
306817
def write_index_and_rst_files(self, overwrite: bool = False,
                                  mock: bool = False) -> None:
        
        for f in self.files_to_index:
            if isinstance(f, FileToAutodocument):
                f.write_rst(
                    prefix=self.rst_prefix,
                    suffix=self.rst_suffix,
                    heading_underline_char=self.source_rst_heading_underline_char,  # noqa
                    overwrite=overwrite,
                    mock=mock,
                )
            elif isinstance(f, AutodocIndex):
                f.write_index_and_rst_files(overwrite=overwrite, mock=mock)
            else:
                fail("Unknown thing in files_to_index: {!r}".format(f))
        self.write_index(overwrite=overwrite, mock=mock)
1071036
public void doClearExampleQueries(String unused)
  {
    for (Long corpusId : corpusList)
    {
      System.out.println("delete example queries for " + corpusId);
      queriesGenerator.delExampleQueries(corpusId);
    }
  }
348990
public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
    {
        $this->io->overwrite($messages, $newline, $verbosity);
    }
976094
public void disableAllOverrides(int pathID, String clientUUID, int overrideType) {
        PreparedStatement statement = null;

        try (Connection sqlConnection = sqlService.getConnection()) {
            ArrayList<Integer> enabledOverrides = new ArrayList<Integer>();
            enabledOverrides.add(Constants.PLUGIN_REQUEST_HEADER_OVERRIDE_ADD);
            enabledOverrides.add(Constants.PLUGIN_REQUEST_HEADER_OVERRIDE_REMOVE);
            enabledOverrides.add(Constants.PLUGIN_REQUEST_OVERRIDE_CUSTOM);
            enabledOverrides.add(Constants.PLUGIN_REQUEST_OVERRIDE_CUSTOM_POST_BODY);

            String overridePlaceholders = preparePlaceHolders(enabledOverrides.size());

            statement = sqlConnection.prepareStatement(
                "DELETE FROM " + Constants.DB_TABLE_ENABLED_OVERRIDE +
                    " WHERE " + Constants.ENABLED_OVERRIDES_PATH_ID + " = ? " +
                    " AND " + Constants.GENERIC_CLIENT_UUID + " = ? " +
                    " AND " + Constants.ENABLED_OVERRIDES_OVERRIDE_ID +
                    (overrideType == Constants.OVERRIDE_TYPE_RESPONSE ? " NOT" : "") +
                    " IN ( " + overridePlaceholders + " )"
            );
            statement.setInt(1, pathID);
            statement.setString(2, clientUUID);
            for (int i = 3; i <= enabledOverrides.size() + 2; ++i) {
                statement.setInt(i, enabledOverrides.get(i - 3));
            }
            statement.execute();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                if (statement != null) {
                    statement.close();
                }
            } catch (Exception e) {
            }
        }
    }
697196
protected void generateSyncOverride(SourceWriter srcWriter, Map<JMethod, JMethod> syncMethToAsyncMethMap) {

        srcWriter.println("@Override");
        srcWriter.println("public boolean isSync(String methodName) {");

        JMethod[] syncMethods = serviceIntf.getOverridableMethods();
        for (JMethod syncMethod : syncMethods) {
            JMethod asyncMethod = syncMethToAsyncMethMap.get(syncMethod);
            if (!asyncMethod.isAnnotationPresent(SynchronizedRpcRequest.class)) {
                continue;
            }
            srcWriter.indentln(
                "if (methodName.equals(\"" + getProxySimpleName() + "." + syncMethod.getName() + "\")) {");
            srcWriter.indentln("return true;");
            srcWriter.indentln("}");
        }
        srcWriter.indentln("return false;");
        srcWriter.println("}");
    }
749634
public function clear(): void
    {
        if (!$this->overwrite) {
            return;
        }

        if (null === $this->format) {
            $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
        }

        $this->overwrite('');
    }
843213
public function stopSection($overwrite = false)
    {
        $context = $this->_context;

        if (!$context->stack) {
            throw new PreconditionException('cannot stop a section without first starting session');
        }

        $last = array_pop($context->stack);
        if ($overwrite || !isset($context->sections[$last])) {
            $context->sections[$last] = ob_get_clean();
        } else {
            $context->sections[$last] .= ob_get_clean();
        }
    }
499313
public void createOverride(int groupId, String methodName, String className) throws Exception {
        // first make sure this doesn't already exist
        for (Method method : EditService.getInstance().getMethodsFromGroupId(groupId, null)) {
            if (method.getMethodName().equals(methodName) && method.getClassName().equals(className)) {
                // don't add if it already exists in the group
                return;
            }
        }

        try (Connection sqlConnection = sqlService.getConnection()) {
            PreparedStatement statement = sqlConnection.prepareStatement(
                "INSERT INTO " + Constants.DB_TABLE_OVERRIDE
                    + "(" + Constants.OVERRIDE_METHOD_NAME
                    + "," + Constants.OVERRIDE_CLASS_NAME
                    + "," + Constants.OVERRIDE_GROUP_ID
                    + ")"
                    + " VALUES (?, ?, ?)"
            );
            statement.setString(1, methodName);
            statement.setString(2, className);
            statement.setInt(3, groupId);
            statement.executeUpdate();
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
733760
public void generateQueries(String name, boolean delete)
  {
    List<String> names = new ArrayList<>();
    names.add(name);
    List<Long> ids = queryDao.mapCorpusNamesToIds(names);
    if (!ids.isEmpty())
    {
      generateQueries(ids.get(0), delete);
    }
    else
    {
      log.error("{} is unknown to the system", name);
    }
  }
246775
protected Dataset<Instance> getDataset(Resource data, String format, CorpusType corpusType, boolean undersample, boolean oversample) {
        Corpus corpus = Corpus.builder()
                .format(format)
                .source(data)
                .corpusType(corpusType)
                .build();
        AnnotatableType[] required = required();
        if (required != null && required.length > 0) {
            corpus = corpus.annotate(required);
        }


        Corpus filtered = corpus;
        SerializablePredicate<HString> predicate = getTextFilter();
        if (predicate != null) {
            filtered = corpus.filter(getTextFilter());
        }
        Dataset<Instance> dataset = Dataset
                .classification()
                .featureEncoder(getFeatureEncoder())
                .type(corpus.getDataSetType())
                .source(filtered
                        .asLabeledStream(getOracle())
                        .map(getFeaturizer()::extractInstance));


        if (undersample) {
            dataset = dataset.undersample();
        }
        if (oversample) {
            dataset = dataset.oversample();
        }

        return dataset.shuffle(new Random(34));
    }
1046745
def index(self, overwrite=False):
        
        if self.requires_gtf:
            self.db.connect_or_create(overwrite=overwrite)
        if self.requires_transcript_fasta:
            self.transcript_sequences.index(overwrite=overwrite)
        if self.requires_protein_fasta:
            self.protein_sequences.index(overwrite=overwrite)
44360
protected void updateOverwriteExisting() {

        if (m_overwriteExisting != null) {
            boolean move = (m_dialogMode == DialogMode.move) || (m_actionCombo.getValue() == Action.move);
            if (move) {
                m_overwriteExisting.setValue(Boolean.FALSE);
                m_overwriteExisting.setVisible(false);
            } else {
                m_overwriteExisting.setVisible(true);
            }
        }
    }
1118413
private static List<ExampleQuery> loadExamplesFromRemote(Set<String> corpusNames) {
		List<ExampleQuery> result = new LinkedList<>();
		WebResource service = Helper.getAnnisWebResource();
		try {
			if (corpusNames == null || corpusNames.isEmpty()) {
				result = service.path("query").path("corpora").path("example-queries")
						.get(new GenericType<List<ExampleQuery>>() {
						});
			} else {
				String concatedCorpusNames = StringUtils.join(corpusNames, ",");
				result = service.path("query").path("corpora").path("example-queries")
						.queryParam("corpora", concatedCorpusNames).get(new GenericType<List<ExampleQuery>>() {
						});
			}
		} catch (UniformInterfaceException ex) {
			// ignore
		} catch (ClientHandlerException ex) {
			log.error("problems with getting example queries from remote for {}", corpusNames, ex);
		}
		return result;
	}
1163490
public function decodeFile( $fileName, $overwrite = FALSE )
	{
		if( file_exists( $fileName ) )
		{
			if( $this->isEncoded( $fileName ) )
			{
				$file	= new FS_File_Editor( $fileName );
				$php	= $file->readString();
				$code	= $this->encode( $php );
				$dirname	= dirname( $fileName );
				$basename	= basename( $fileName );
				$target	= $dirname."/".substr( $basename, strlen( $this->filePrefix) , -strlen( $this->fileSuffix ) );
				if( $fileName == $target && !$overwrite )
					throw new RuntimeException( 'File cannot be overwritten, use Parameter "overwrite".' );
				$file->writeString( $code );
				return TRUE;
			}
		}
		return FALSE;	
	}