Search in sources :

Example 61 with Column

use of com.google.refine.model.Column in project OpenRefine by OpenRefine.

the class Criterion method initializeFromJSON.

public void initializeFromJSON(Project project, JSONObject obj) throws JSONException {
    if (obj.has("column") && !obj.isNull("column")) {
        columnName = obj.getString("column");
        Column column = project.columnModel.getColumnByName(columnName);
        cellIndex = column != null ? column.getCellIndex() : -1;
    }
    if (obj.has("blankPosition") && !obj.isNull("blankPosition")) {
        blankPosition = obj.getInt("blankPosition");
    }
    if (obj.has("errorPosition") && !obj.isNull("errorPosition")) {
        errorPosition = obj.getInt("errorPosition");
    }
    if (obj.has("reverse") && !obj.isNull("reverse")) {
        reverse = obj.getBoolean("reverse");
    }
}
Also used : Column(com.google.refine.model.Column)

Example 62 with Column

use of com.google.refine.model.Column in project OpenRefine by OpenRefine.

the class UrlFetchingTests method SetUp.

@BeforeMethod
public void SetUp() throws JSONException, IOException, ModelException {
    File dir = TestUtils.createTempDirectory("openrefine-test-workspace-dir");
    FileProjectManager.initialize(dir);
    project = new Project();
    ProjectMetadata pm = new ProjectMetadata();
    pm.setName("URL Fetching Test Project");
    ProjectManager.singleton.registerProject(project, pm);
    int index = project.columnModel.allocateNewCellIndex();
    Column column = new Column(index, "fruits");
    project.columnModel.addColumn(index, column, true);
    options = mock(Properties.class);
    engine = new Engine(project);
    engine_config = new JSONObject(ENGINE_JSON_URLS);
    engine.initializeFromJSON(engine_config);
    engine.setMode(Engine.Mode.RowBased);
    bindings = new Properties();
    bindings.put("project", project);
}
Also used : Project(com.google.refine.model.Project) JSONObject(org.json.JSONObject) Column(com.google.refine.model.Column) ProjectMetadata(com.google.refine.ProjectMetadata) Properties(java.util.Properties) File(java.io.File) Engine(com.google.refine.browsing.Engine) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

Column (com.google.refine.model.Column)62 Row (com.google.refine.model.Row)25 Cell (com.google.refine.model.Cell)19 Project (com.google.refine.model.Project)16 ArrayList (java.util.ArrayList)14 JSONObject (org.json.JSONObject)14 JSONException (org.json.JSONException)11 HistoryEntry (com.google.refine.history.HistoryEntry)10 RowVisitor (com.google.refine.browsing.RowVisitor)9 Engine (com.google.refine.browsing.Engine)7 ParsingException (com.google.refine.expr.ParsingException)7 CellChange (com.google.refine.model.changes.CellChange)7 Serializable (java.io.Serializable)7 Properties (java.util.Properties)7 FilteredRows (com.google.refine.browsing.FilteredRows)6 NumericBinIndex (com.google.refine.browsing.util.NumericBinIndex)6 ColumnGroup (com.google.refine.model.ColumnGroup)6 IOException (java.io.IOException)6 HashMap (java.util.HashMap)6 Evaluable (com.google.refine.expr.Evaluable)5