Merge pull request #1 from OpenRefine/master

update from master
This commit is contained in:
magdmartin 2015-03-11 14:56:27 -04:00
commit 96d050a92b
46 changed files with 200 additions and 130 deletions

View File

@ -69,7 +69,7 @@
<classpathentry exported="true" kind="lib" path="main/webapp/WEB-INF/lib/httpcore-4.2.4.jar"/>
<classpathentry exported="true" kind="lib" path="main/webapp/WEB-INF/lib/signpost-commonshttp4-1.2.1.2.jar" sourcepath="main/webapp/WEB-INF/lib-src/signpost-commonshttp4-1.2.1.2-sources.jar"/>
<classpathentry exported="true" kind="lib" path="main/webapp/WEB-INF/lib/signpost-core-1.2.1.2.jar" sourcepath="main/webapp/WEB-INF/lib-src/signpost-core-1.2.1.2-sources.jar"/>
<classpathentry exported="true" kind="lib" path="main/webapp/WEB-INF/lib/guava-13.0.jar"/>
<classpathentry exported="true" kind="lib" path="main/webapp/WEB-INF/lib/guava-18.0.jar"/>
<classpathentry exported="true" kind="lib" path="extensions/freebase/module/MOD-INF/lib/google-api-client-1.13.2-beta.jar" sourcepath="extensions/freebase/module/MOD-INF/libsrc/google-api-client-1.13.2-beta-sources.jar"/>
<classpathentry exported="true" kind="lib" path="extensions/freebase/module/MOD-INF/lib/google-http-client-1.13.1-beta.jar"/>
<classpathentry exported="true" kind="lib" path="extensions/freebase/module/MOD-INF/lib/google-api-services-freebase-v1-rev25-1.13.2-beta.jar" sourcepath="extensions/freebase/module/MOD-INF/libsrc/google-api-services-freebase-v1-rev25-1.13.2-beta-sources.jar"/>

View File

@ -1,6 +1,7 @@
language: java
jdk:
- oraclejdk7
- openjdk6
- oraclejdk8
- openjdk7
script: ./refine test

View File

@ -329,18 +329,17 @@
</fileset>
</copy>
<copy todir="${windows.dir}/licenses">
<fileset dir="${basedir}/licenses">
<include name="**"/>
</fileset>
</copy>
<mkdir dir="${windows.dir}/licenses"/>
<fixcrlf srcDir="${basedir}/licenses" destDir="${windows.dir}/licenses" eol="crlf"/>
<fixcrlf srcDir="${basedir}" destDir="${windows.dir}" eol="crlf">
<include name="refine.bat"/>
<include name="refine.ini"/>
<include name="README.txt"/>
<include name="LICENSE.txt"/>
</fixcrlf>
<fixcrlf file="${conf.dir}/openrefine.l4j.ini" destDir="${windows.dir}" eol="crlf"/>
<copy file="${conf.dir}/openrefine.l4j.ini" tofile="${windows.dir}/openrefine.l4j.ini"/>
<copy file="${basedir}/refine.bat" tofile="${windows.dir}/refine.bat"/>
<copy file="${basedir}/refine.ini" tofile="${windows.dir}/refine.ini"/>
<copy file="${basedir}/README.txt" tofile="${windows.dir}/README.txt"/>
<copy file="${basedir}/LICENSE.txt" tofile="${windows.dir}/LICENSE.txt"/>
<mkdir dir="${dist.dir}"/>
<zip destfile="${dist.dir}/openrefine-win-${version}.zip" basedir="${windows.dir}/.." includes="${release.name}/**"/>
</target>
@ -362,16 +361,16 @@
</fileset>
</copy>
<copy todir="${linux.dir}/licenses">
<fileset dir="${basedir}/licenses">
<include name="**"/>
</fileset>
</copy>
<copy file="${basedir}/refine.ini" tofile="${linux.dir}/refine.ini"/>
<copy file="${basedir}/LICENSE.txt" tofile="${linux.dir}/LICENSE.txt"/>
<copy file="${basedir}/README.txt" tofile="${linux.dir}/README.txt"/>
<copy file="${basedir}/refine" tofile="${linux.dir}/refine"/>
<mkdir dir="${linux.dir}/licenses"/>
<fixcrlf srcDir="${basedir}/licenses" destDir="${linux.dir}/licenses" eol="lf"/>
<fixcrlf srcDir="${basedir}" destDir="${linux.dir}" eol="lf">
<include name="refine"/>
<include name="refine.ini"/>
<include name="README.txt"/>
<include name="LICENSE.txt"/>
</fixcrlf>
<mkdir dir="${dist.dir}"/>
<tar longfile="gnu" compression="gzip" destfile="${dist.dir}/openrefine-linux-${version}.tar.gz">
<tarfileset dir="${linux.dir}/.." filemode="755">

View File

@ -6,11 +6,18 @@
<classpathentry kind="lib" path="/grefine/webapp/WEB-INF/lib/json-20100208.jar" sourcepath="/grefine/webapp/WEB-INF/lib-src/json-20100208-sources.jar"/>
<classpathentry kind="lib" path="/grefine-server/lib/servlet-api-2.5.jar" sourcepath="/grefine-server/lib-src/servlet-api-2.5-sources.jar"/>
<classpathentry kind="lib" path="/grefine-server/lib/slf4j-api-1.5.6.jar"/>
<classpathentry kind="lib" path="/grefine/webapp/WEB-INF/lib/httpclient-4.0.1.jar" sourcepath="/grefine/webapp/WEB-INF/lib-src/httpclient-4.0.1-sources.jar"/>
<classpathentry kind="lib" path="/grefine/webapp/WEB-INF/lib/httpcore-4.0.1.jar" sourcepath="/grefine/webapp/WEB-INF/lib-src/httpcore-4.0.1-sources.jar"/>
<classpathentry kind="lib" path="/grefine/webapp/WEB-INF/lib/signpost-commonshttp4-1.2.1.1.jar"/>
<classpathentry kind="lib" path="/grefine/webapp/WEB-INF/lib/signpost-core-1.2.1.1.jar"/>
<classpathentry kind="lib" path="/grefine/webapp/WEB-INF/lib/httpclient-4.2.5.jar" sourcepath="/grefine/webapp/WEB-INF/lib-src/httpclient-4.2.5-sources.jar"/>
<classpathentry kind="lib" path="/grefine/webapp/WEB-INF/lib/httpcore-4.2.4.jar" sourcepath="/grefine/webapp/WEB-INF/lib-src/httpcore-4.2.4-sources.jar"/>
<classpathentry kind="lib" path="/grefine/webapp/WEB-INF/lib/signpost-commonshttp4-1.2.1.2.jar"/>
<classpathentry kind="lib" path="/grefine/webapp/WEB-INF/lib/signpost-core-1.2.1.2.jar"/>
<classpathentry kind="lib" path="/grefine/webapp/WEB-INF/lib/commons-collections-3.2.1.jar"/>
<classpathentry kind="lib" path="/grefine/webapp/WEB-INF/lib/commons-lang-2.5.jar" sourcepath="/grefine/webapp/WEB-INF/lib-src/commons-lang-2.5-sources.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/google-http-client-jackson-1.13.1-beta.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/google-api-client-1.13.2-beta.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/commons-logging-1.1.1.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/google-api-services-freebase-v1-rev25-1.13.2-beta.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/google-http-client-1.13.1-beta.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/google-oauth-client-servlet-1.13.1-beta.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/mail.jar"/>
<classpathentry kind="output" path="module/MOD-INF/classes"/>
</classpath>

View File

@ -0,0 +1 @@
/classes/

View File

@ -39,7 +39,7 @@ var lang = navigator.language.split("-")[0]
|| navigator.userLanguage.split("-")[0];
var dictionary = "";
$.ajax({
url : "/command/core/load-language?",
url : "command/core/load-language?",
type : "POST",
async : false,
data : {

View File

@ -9,7 +9,22 @@
<classpathentry combineaccessrules="false" kind="src" path="/grefine"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/gdata-core-1.0.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/gdata-spreadsheet-3.0.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/google-collect-1.0-rc1.jar"/>
<classpathentry kind="lib" path="/grefine-all/extensions/gdata/module/MOD-INF/lib/gdata-docs-3.0.jar"/>
<classpathentry kind="lib" path="/grefine/webapp/WEB-INF/lib/butterfly-1.0.1.jar"/>
<classpathentry kind="lib" path="/grefine/webapp/WEB-INF/lib/jackson-core-asl-1.9.12.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/google-api-client-1.13.2-beta.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/gdata-base-1.0.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/gdata-client-1.0.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/gdata-client-meta-1.0.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/gdata-docs-3.0.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/gdata-docs-meta-3.0.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/gdata-media-1.0.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/gdata-spreadsheet-meta-3.0.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/google-api-services-fusiontables-v1-rev17-1.13.2-beta.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/google-http-client-1.13.1-beta.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/google-http-client-jackson-1.13.1-beta.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/google-oauth-client-1.13.1-beta.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/google-oauth-client-servlet-1.13.1-beta.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/jsr305-1.3.9.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/mail.jar"/>
<classpathentry kind="output" path="module/MOD-INF/classes"/>
</classpath>

View File

@ -0,0 +1 @@
/classes/

View File

@ -36,7 +36,7 @@ var lang = navigator.language.split("-")[0]
|| navigator.userLanguage.split("-")[0];
var dictionary = "";
$.ajax({
url : "/command/core/load-language?",
url : "command/core/load-language?",
type : "POST",
async : false,
data : {

View File

@ -33,7 +33,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
var dictionary = "";
$.ajax({
url : "/command/core/load-language?",
url : "command/core/load-language?",
type : "POST",
async : false,
data : {

View File

@ -165,7 +165,7 @@ public class FusionTableImporter {
List<Object> row = rows.get(i);
List<Object> rowOfCells = new ArrayList<Object>(row.size());
for (int j = 0; j < row.size() && j < columns.size(); j++) {
String text = (String)row.get(j);
String text = String.valueOf(row.get(j));
if (text.isEmpty()) {
rowOfCells.add(null);
} else {

View File

@ -37,7 +37,7 @@ final class FusionTableSerializer implements TabularSerializer {
@Override
public void endFile() {
if (sbBatch != null) {
sendBatch(true);
sendBatch(rows % BATCH_SIZE);
}
}
@ -61,25 +61,21 @@ final class FusionTableSerializer implements TabularSerializer {
formatCsv(cells, sbBatch);
rows++;
if (rows % BATCH_SIZE == 0) {
if (!sendBatch(false)) {
if (!sendBatch(BATCH_SIZE)) {
return;
}
}
}
}
private boolean sendBatch(boolean isLastChunk) {
private boolean sendBatch(int batchSize) {
try {
// TODO: we really want to do GZIP compression here
// FIXME: text/csv doesn't work even though that's what the content is
AbstractInputStreamContent content = ByteArrayContent.fromString("application/octet-stream", sbBatch.toString());
// AbstractInputStreamContent content = new InputStreamContent("application/octet-stream",
// // TODO: we really want to do GZIP compression here
// new ByteArrayInputStream(sbBatch.toString().getBytes("UTF-8")));
AbstractInputStreamContent content = ByteArrayContent.fromString("application/octet-stream", sbBatch.toString());
Long count = FusionTableHandler.insertRows(service, tableId, content);
if (!isLastChunk && count != BATCH_SIZE) {
// FIXME: this message should say numbers instead of %d but we'd need to know the batch number for this
exceptions.add(new IOException("Only imported %d of %d rows"));
if (count != null && count.intValue() != batchSize) {
exceptions.add(new IOException("only imported " + count + " of " + batchSize + " rows"));
}
} catch (IOException e) {
exceptions.add(e);
@ -107,49 +103,13 @@ final class FusionTableSerializer implements TabularSerializer {
}
sb.append("\"");
if (cellData != null && cellData.text != null) {
sb.append(cellData.text.replaceAll("\"", "\\\\\""));
sb.append(cellData.text.replaceAll("\"", "\"\""));
}
sb.append("\"");
}
sb.append("\n");
}
// Old-style SQL INSERT can be removed once we're sure importRows will work
private void formulateInsert(List<CellData> cells, StringBuffer sb) {
StringBuffer sbColumnNames = new StringBuffer();
StringBuffer sbValues = new StringBuffer();
boolean first = true;
for (int i = 0; i < cells.size() && i < columnNames.size(); i++) {
CellData cellData = cells.get(i);
if (first) {
first = false;
} else {
sbColumnNames.append(',');
sbValues.append(',');
}
sbColumnNames.append("'");
sbColumnNames.append(columnNames.get(i));
sbColumnNames.append("'");
sbValues.append("'");
if (cellData != null && cellData.text != null) {
sbValues.append(cellData.text.replaceAll("'", "\\\\'"));
}
sbValues.append("'");
}
if (sb.length() > 0) {
sb.append(';');
}
sb.append("INSERT INTO ");
sb.append(tableId);
sb.append("(");
sb.append(sbColumnNames.toString());
sb.append(") values (");
sb.append(sbValues.toString());
sb.append(")");
}
public String getUrl() {
return tableId == null || exceptions.size() > 0 ? null :
"https://www.google.com/fusiontables/DataSource?docid=" + tableId;

View File

@ -3,6 +3,6 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry combineaccessrules="false" kind="src" path="/grefine"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/jython-2.5.1.jar"/>
<classpathentry kind="lib" path="module/MOD-INF/lib/jython-standalone-2.5.3.jar"/>
<classpathentry kind="output" path="module/MOD-INF/classes"/>
</classpath>

View File

@ -0,0 +1 @@
/classes/

View File

@ -0,0 +1 @@
/classes/

View File

@ -3,8 +3,8 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="tests/server/src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry exported="true" kind="lib" path="webapp/WEB-INF/lib/butterfly-trunk.jar" sourcepath="webapp/WEB-INF/lib-src/butterfly-trunk-sources.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/commons-codec-1.5.jar" sourcepath="webapp/WEB-INF/lib-src/commons-codec-1.4-sources.jar"/>
<classpathentry exported="true" kind="lib" path="webapp/WEB-INF/lib/butterfly-1.0.1.jar" sourcepath="webapp/WEB-INF/lib-src/butterfly-1.0.1-sources.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/commons-codec-1.6.jar" sourcepath="webapp/WEB-INF/lib-src/commons-codec-1.6-sources.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/commons-lang-2.5.jar" sourcepath="webapp/WEB-INF/lib-src/commons-lang-2.5-sources.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/commons-fileupload-1.2.1.jar" sourcepath="webapp/WEB-INF/lib-src/commons-fileupload-1.2.1-sources.jar"/>
<classpathentry exported="true" kind="lib" path="webapp/WEB-INF/lib/json-20100208.jar" sourcepath="webapp/WEB-INF/lib-src/json-20100208-sources.jar"/>
@ -13,18 +13,18 @@
<classpathentry kind="lib" path="webapp/WEB-INF/lib/secondstring-20100303.jar" sourcepath="webapp/WEB-INF/lib-src/secondstring-20100303-sources.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/ant-tools-1.8.0.jar" sourcepath="webapp/WEB-INF/lib-src/ant-tools-1.8.0-sources.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/vicino-1.1.jar" sourcepath="webapp/WEB-INF/lib-src/vicino-1.1-sources.jar"/>
<classpathentry exported="true" kind="lib" path="webapp/WEB-INF/lib/opencsv-2.2.jar" sourcepath="tests/java/lib-src/opencsv-2.2-sources.jar"/>
<classpathentry exported="true" kind="lib" path="webapp/WEB-INF/lib/opencsv-2.4-SNAPSHOT.jar" sourcepath="tests/java/lib-src/opencsv-2.4-SNAPSHOT-sources.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/jcl-over-slf4j-1.5.6.jar" sourcepath="webapp/WEB-INF/lib-src/jcl-over-slf4j-1.5.6-sources.jar"/>
<classpathentry exported="true" kind="lib" path="webapp/WEB-INF/lib/slf4j-api-1.5.6.jar" sourcepath="webapp/WEB-INF/lib/slf4j-api-1.5.6.jar"/>
<classpathentry exported="true" kind="lib" path="webapp/WEB-INF/lib/slf4j-log4j12-1.5.6.jar" sourcepath="webapp/WEB-INF/lib-src/slf4j-log4j12-1.5.6-sources.jar"/>
<classpathentry exported="true" kind="lib" path="webapp/WEB-INF/lib/log4j-1.2.15.jar" sourcepath="webapp/WEB-INF/lib-src/log4j-1.2.15-sources.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/poi-3.7-20101029.jar" sourcepath="webapp/WEB-INF/lib-src/poi-3.6-sources.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/poi-ooxml-3.7-20101029.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/poi-ooxml-schemas-3.7-20101029.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/poi-3.8-20120326.jar" sourcepath="webapp/WEB-INF/lib-src/poi-src-3.8.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/poi-ooxml-3.8-20120326.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/poi-ooxml-schemas-3.8-20120326.jar"/>
<classpathentry exported="true" kind="lib" path="webapp/WEB-INF/lib/dom4j-1.6.1.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/xmlbeans-2.3.0.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/clojure-1.4.0.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/jackson-core-asl-1.5.1.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/clojure-1.5.1-slim.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/jackson-core-asl-1.9.12.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/marc4j-2.4.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/jrdf-0.5.6.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/commons-collections-3.2.1.jar"/>
@ -32,13 +32,15 @@
<classpathentry kind="lib" path="webapp/WEB-INF/lib/rhino-1.7R2.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/velocity-1.5.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/lessen-trunk-r8.jar"/>
<classpathentry kind="lib" path="tests/server/lib/mockito-all-1.8.4.jar" sourcepath="tests/server/lib-src/mockito-all-1.8.4-sources.jar"/>
<classpathentry kind="lib" path="tests/server/lib/testng-5.12.1.jar" sourcepath="tests/server/lib-src/testng-5.12.1-sources.jar"/>
<classpathentry kind="lib" path="tests/server/lib/mockito-all-1.9.5.jar" sourcepath="tests/server/lib-src/mockito-all-1.9.5-sources.jar"/>
<classpathentry kind="lib" path="tests/server/lib/testng-6.8.jar" sourcepath="tests/server/lib-src/testng-6.8-sources.jar"/>
<classpathentry exported="true" kind="lib" path="/grefine-server/lib/servlet-api-2.5.jar" sourcepath="/grefine-server/lib-src/servlet-api-2.5-sources.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/httpclient-4.0.1.jar" sourcepath="webapp/WEB-INF/lib-src/httpclient-4.0.1-sources.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/httpcore-4.0.1.jar" sourcepath="webapp/WEB-INF/lib-src/httpcore-4.0.1-sources.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/signpost-commonshttp4-1.2.1.1.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/signpost-core-1.2.1.1.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/httpclient-4.2.5.jar" sourcepath="webapp/WEB-INF/lib-src/httpclient-4.2.5-sources.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/httpcore-4.2.4.jar" sourcepath="webapp/WEB-INF/lib-src/httpcore-4.2.4-sources.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/signpost-commonshttp4-1.2.1.2.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/signpost-core-1.2.1.2.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/jsoup-1.4.1.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/odfdom-java-0.8.7.jar"/>
<classpathentry kind="lib" path="webapp/WEB-INF/lib/guava-18.0.jar"/>
<classpathentry kind="output" path="webapp/WEB-INF/classes"/>
</classpath>

View File

@ -167,7 +167,7 @@ public class GuessTypesOfColumnCommand extends Command {
URL url = new URL(serviceUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
{
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
connection.setConnectTimeout(30000);
connection.setDoOutput(true);

View File

@ -39,7 +39,7 @@ import static org.jrdf.graph.AnySubjectNode.ANY_SUBJECT_NODE;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@ -107,7 +107,7 @@ public class RdfTripleImporter extends ImportingParserBase {
ClosableIterable<Triple> triples = graph.find(ANY_SUBJECT_NODE, ANY_PREDICATE_NODE, ANY_OBJECT_NODE);
try {
Map<String, List<Row>> subjectToRows = new HashMap<String, List<Row>>();
Map<String, List<Row>> subjectToRows = new LinkedHashMap<String, List<Row>>();
Column subjectColumn = new Column(project.columnModel.allocateNewCellIndex(), "subject");
project.columnModel.addColumn(0, subjectColumn, false);
project.columnModel.setKeyColumnIndex(0);

View File

@ -1,6 +1,6 @@
package com.google.refine.importers.tree;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
@ -9,8 +9,8 @@ import org.apache.commons.lang.StringUtils;
* A column group describes a branch in tree structured data
*/
public class ImportColumnGroup extends ImportVertical {
public Map<String, ImportColumnGroup> subgroups = new HashMap<String, ImportColumnGroup>();
public Map<String, ImportColumn> columns = new HashMap<String, ImportColumn>();
public Map<String, ImportColumnGroup> subgroups = new LinkedHashMap<String, ImportColumnGroup>();
public Map<String, ImportColumn> columns = new LinkedHashMap<String, ImportColumn>();
public int nextRowIndex; // TODO: this can be hoisted into superclass
@Override

View File

@ -51,6 +51,7 @@ import com.google.refine.expr.ExpressionUtils;
import com.google.refine.expr.HasFields;
import com.google.refine.util.ParsingUtilities;
import com.google.refine.util.Pool;
import com.google.refine.util.StringUtils;
public class Cell implements HasFields, Jsonizable {
final public Serializable value;
@ -193,6 +194,6 @@ public class Cell implements HasFields, Jsonizable {
@Override
public String toString() {
return value.toString();
return StringUtils.toString(value);
}
}

View File

@ -33,7 +33,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package com.google.refine.model.changes;
import java.io.IOException;
import java.io.IOException;
import com.google.common.collect.Lists;
import java.io.LineNumberReader;
import java.io.Writer;
import java.util.ArrayList;
@ -70,7 +72,7 @@ public class MassChange implements Change {
@Override
public void revert(Project project) {
synchronized (project) {
for (Change change : _changes) {
for (Change change : Lists.reverse(_changes)){
change.revert(project);
}

View File

@ -71,9 +71,7 @@ public class MassReconChange implements Change {
protected void switchRecons(Project project, Map<Long, Recon> reconMap) {
synchronized (project) {
for (int r = 0; r < project.rows.size(); r++) {
Row row = project.rows.get(r);
for (Row row : project.rows) {
for (int c = 0; c < row.cells.size(); c++) {
Cell cell = row.cells.get(c);
if (cell != null && cell.recon != null) {

View File

@ -335,7 +335,7 @@ public class StandardReconConfig extends ReconConfig {
URL url = new URL(service);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
{
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
connection.setConnectTimeout(30000);
connection.setDoOutput(true);

Binary file not shown.

View File

@ -33,6 +33,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package com.google.refine.tests.expr.functions.strings;
import java.text.DateFormat;
import java.util.GregorianCalendar;
import java.util.Properties;
@ -117,8 +118,10 @@ public class ToFromConversionTests extends RefineTest {
Assert.assertEquals(invoke("toString", Long.valueOf(100)),"100");
Assert.assertEquals(invoke("toString", Double.valueOf(100.0)),"100.0");
Assert.assertEquals(invoke("toString", Double.valueOf(100.0),"%.0f"),"100");
Assert.assertEquals(invoke("toString", CalendarParser.parse("2013-06-01")),"Jun 1, 2013");
Assert.assertEquals(invoke("toString", CalendarParser.parse("2013-06-01").getTime()),"Jun 1, 2013");
String expectedDate = DateFormat.getDateInstance().format(new GregorianCalendar(2013,5,1).getTime());
Assert.assertEquals(invoke("toString", CalendarParser.parse("2013-06-01")), expectedDate);
Assert.assertEquals(invoke("toString", CalendarParser.parse("2013-06-01").getTime()), expectedDate);
Assert.assertEquals(invoke("toString", CalendarParser.parse("2013-06-01"),"yyyy"),"2013");
Assert.assertEquals(invoke("toString", CalendarParser.parse("2013-06-01"),"yyyy-MM-dd"),"2013-06-01");
}

View File

@ -264,10 +264,10 @@ public class XmlImportUtilitiesTests extends RefineTest {
XmlImportUtilitiesStub.createColumnsFromImport(project, columnGroup);
log(project);
assertProjectCreated(project, 4, 0);
Assert.assertEquals(project.columnModel.columns.get(0).getName(), "world");
Assert.assertEquals(project.columnModel.columns.get(1).getName(), "hello");
Assert.assertEquals(project.columnModel.columns.get(2).getName(), "bar");
Assert.assertEquals(project.columnModel.columns.get(3).getName(), "foo");
Assert.assertEquals(project.columnModel.columns.get(0).getName(), "hello");
Assert.assertEquals(project.columnModel.columns.get(1).getName(), "world");
Assert.assertEquals(project.columnModel.columns.get(2).getName(), "foo");
Assert.assertEquals(project.columnModel.columns.get(3).getName(), "bar");
Assert.assertEquals(project.columnModel.columnGroups.get(0).keyColumnIndex, 2);
Assert.assertEquals(project.columnModel.columnGroups.get(0).startColumnIndex, 2);
Assert.assertEquals(project.columnModel.columnGroups.get(0).columnSpan, 2);

View File

@ -0,0 +1,67 @@
package com.google.refine.tests.model.changes;
import static org.testng.AssertJUnit.assertTrue;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.LoggerFactory;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import com.google.refine.ProjectManager;
import com.google.refine.ProjectMetadata;
import com.google.refine.model.ModelException;
import com.google.refine.model.Project;
import com.google.refine.model.changes.CellAtRow;
import com.google.refine.model.changes.ColumnAdditionChange;
import com.google.refine.model.changes.MassChange;
import com.google.refine.history.Change;
import com.google.refine.io.FileProjectManager;
import com.google.refine.tests.RefineTest;
import com.google.refine.tests.util.TestUtils;
public class MassChangeTests extends RefineTest {
Project project;
@Override
@BeforeTest
public void init() {
logger = LoggerFactory.getLogger(this.getClass());
}
@BeforeMethod
public void SetUp()
throws IOException, ModelException {
File dir = TestUtils.createTempDirectory("openrefine-test-workspace-dir");
FileProjectManager.initialize(dir);
project = new Project();
ProjectMetadata pm = new ProjectMetadata();
pm.setName("TNG Test Project");
ProjectManager.singleton.registerProject(project, pm);
}
/**
* Test case for #914 - Demonstrates MassChange revert doesn't work by
* adding two columns to a project with a MassChange and then reverting.
* Without the fix, column "a" will be removed before column "b", causing
* column "b" removal to fail because it won't be found at index 1 as
* expected.
*/
@Test
public void testWrongReverseOrder()
throws Exception {
List<Change> changes = new ArrayList<Change>();
changes.add(new ColumnAdditionChange("a", 0, new ArrayList<CellAtRow>()));
changes.add(new ColumnAdditionChange("b", 1, new ArrayList<CellAtRow>()));
MassChange massChange = new MassChange(changes, false);
massChange.apply(project);
massChange.revert(project);
assertTrue(project.columnModel.columns.isEmpty());
}
}

Binary file not shown.

Binary file not shown.

View File

@ -36,11 +36,11 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>OpenRefine</title>
<link rel="icon" type="image/png" href="images/favicon.png">
$styleInjection
<script type="text/javascript">var theProject = { id : $projectID };</script>
<script type="text/javascript" src="wirings.js"></script>
<link rel="icon" type="image/png" href="images/favicon.png">
$scriptInjection
$styleInjection
<script>Refine.encodings = $encodingJson; Refine.defaultEncoding = $defaultEncoding;</script>
</head>
<body>

View File

@ -40,7 +40,7 @@ var Refine = {
var lang = (navigator.language|| navigator.userLanguage).split("-")[0];
var dictionary = "";
$.ajax({
url : "/command/core/load-language?",
url : "command/core/load-language?",
type : "POST",
async : false,
data : {

View File

@ -11,7 +11,7 @@ Refine.SetLanguageUI = function(elmt) {
$.ajax({
url : "/command/core/get-languages?",
url : "command/core/get-languages?",
type : "GET",
async : false,
data : {
@ -29,7 +29,7 @@ Refine.SetLanguageUI = function(elmt) {
this._elmts.set_lan_btn.bind('click', function(e) {
$.ajax({
url : "/command/core/set-preference?",
url : "command/core/set-preference?",
type : "POST",
async : false,
data : {

View File

@ -36,7 +36,7 @@ var preferenceUIs = [];
var lang = (navigator.language|| navigator.userLanguage).split("-")[0];
var dictionary = "";
$.ajax({
url : "/command/core/load-language?",
url : "command/core/load-language?",
type : "POST",
async : false,
data : {

View File

@ -37,7 +37,7 @@ var ui = {};
var lang = (navigator.language|| navigator.userLanguage).split("-")[0];
var dictionary = "";
$.ajax({
url : "/command/core/load-language?",
url : "command/core/load-language?",
type : "POST",
async : false,
data : {

View File

@ -155,10 +155,11 @@ ReconciliationManager.save = function(f) {
ReconciliationManager.standardServices = JSON.parse(data.value);
ReconciliationManager._rebuildMap();
} else {
ReconciliationManager.registerStandardService(
// FIXME: Standard recon service needs to be replaced
// ReconciliationManager.registerStandardService(
// "http://reconcile.freebaseapps.com/reconcile"
"http://standard-reconcile.freebaseapps.com/reconcile"
);
// "http://standard-reconcile.freebaseapps.com/reconcile"
// );
}
},
dataType: "json"

13
refine
View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
##########################################################
# OpenRefine Control System #
@ -15,12 +15,12 @@ exit 1
}
error() {
echo "$1"
echo "Error: $1"
exit 1
}
warn() {
echo "$1"
echo "Warning: $1"
exit 0
}
@ -633,8 +633,6 @@ ui_test() {
server_test() {
ant server_test
$RUN_CMD || error "Failed passing server tests"
}
run() {
@ -917,6 +915,11 @@ if [ -z "$REFINE_MEMORY" ] ; then
fi
add_option "-Xms256M -Xmx$REFINE_MEMORY -Drefine.memory=$REFINE_MEMORY"
if [ -z "$REFINE_MAX_FORM_CONTENT_SIZE" ] ; then
REFINE_MAX_FORM_CONTENT_SIZE="1048576"
fi
add_option "-Drefine.max_form_content_size=$REFINE_MAX_FORM_CONTENT_SIZE"
if [ -z "$REFINE_PORT" ] ; then
REFINE_PORT="3333"
fi

View File

@ -46,6 +46,9 @@ echo.
echo build ..................... Build OpenRefine
echo run ....................... Run OpenRefine
echo.
echo server_test ............... Run the server tests
echo.
echo clean ..................... Clean compiled classes
echo distclean ................. Remove all generated files
echo.
@ -163,6 +166,7 @@ rem ----- Respond to the action ------------------------------------------------
set ACTION=%1
if ""%ACTION%"" == ""build"" goto doAnt
if ""%ACTION%"" == ""server_test"" goto doAnt
if ""%ACTION%"" == ""clean"" goto doAnt
if ""%ACTION%"" == ""distclean"" goto doAnt
if ""%ACTION%"" == ""run"" goto doRun

View File

@ -5,6 +5,9 @@ no_proxy="localhost,127.0.0.1"
#REFINE_PORT=3334
#REFINE_HOST=127.0.0.1
#REFINE_WEBAPP=main\webapp
# Memory and max form size allocations
#REFINE_MAX_FORM_CONTENT_SIZE=1048576
REFINE_MEMORY=1400M
# Some sample configurations. These have no defaults.