Provide default identifierSpace and schemaSpace for reconciliation services. Closes #1936.

This commit is contained in:
Antonin Delpeuch 2019-01-22 19:04:25 +01:00
parent 6dd9f41639
commit fcc6aa05d7
2 changed files with 18 additions and 2 deletions

View File

@ -75,6 +75,9 @@ import com.google.refine.util.ParsingUtilities;
public class StandardReconConfig extends ReconConfig {
final static Logger logger = LoggerFactory.getLogger("refine-standard-recon");
private static final String DEFAULT_SCHEMA_SPACE = "http://localhost/schema";
private static final String DEFAULT_IDENTIFIER_SPACE = "http://localhost/identifier";
static public class ColumnDetail {
@JsonProperty("column")
final public String columnName;
@ -208,8 +211,8 @@ public class StandardReconConfig extends ReconConfig {
int limit
) {
this.service = service;
this.identifierSpace = identifierSpace;
this.schemaSpace = schemaSpace;
this.identifierSpace = identifierSpace != null ? identifierSpace : DEFAULT_IDENTIFIER_SPACE;
this.schemaSpace = schemaSpace != null ? schemaSpace : DEFAULT_SCHEMA_SPACE;
this.typeID = typeID;
this.typeName = typeName;

View File

@ -154,6 +154,19 @@ public class StandardReconConfigTests extends RefineTest {
assertNull(config.typeName);
}
@Test
public void testReconstructNoIdentifierSchemaSpaces() throws IOException {
String json = "{\"mode\":\"standard-service\","
+ "\"service\":\"https://tools.wmflabs.org/openrefine-wikidata/en/api\","
+ "\"type\":null,"
+ "\"autoMatch\":true,"
+ "\"columnDetails\":[],"
+ "\"limit\":0}";
StandardReconConfig config = StandardReconConfig.reconstruct(json);
assertEquals(config.identifierSpace, "http://localhost/identifier");
assertEquals(config.schemaSpace, "http://localhost/schema");
}
@Test
public void formulateQueryTest() throws IOException {
Project project = createCSVProject("title,director\n"