Add RML-Core RDB test cases (RMLTC0000-RDB to RMLTC0021a-RDB) - #58
Add RML-Core RDB test cases (RMLTC0000-RDB to RMLTC0021a-RDB)#58arcangelo7 wants to merge 3 commits into
Conversation
Port the 59 PostgreSQL test cases removed from rml-core in kg-construct/rml-core@2a232cf ("test-cases: only keep JSON") as RMLTC*-RDB, following the guidance in kg-construct/rml-core#266. Deviations from the removed snapshot: - RMLTC0007h: objectMap references FirstName and graphMap references ID instead of the non-existent Name column, so the only intended error is the literal graph term (mirrors kg-construct/rml-core#143) - RMLTC0019a, RMLTC0020a: expected outputs resolve relative IRIs against http://example.com/ instead of http://example.com/base/ (mirrors kg-construct/rml-core#223) - RMLTC0002e, RMLTC0002g, RMLTC0002h, RMLTC0003a: object maps reference ID instead of the undefined IDs, so each error test fails for one reason only (mirrors the fixes to the JSON variants) - RMLTC0002h: the SQL query duplicates the "ID" column via an alias, as in R2RMLTC0002h, instead of an unquoted query that fails on PostgreSQL before the duplicate-name check is reached - RMLTC0003a: the undefined SQL version identifier is expressed as the undefined reference formulation rml:SQL2000Query with a valid query, matching the intent of R2RMLTC0003a - RMLTC0002i, RMLTC0002j: the queries select the "ID" and "Name" columns the mapping references (qualified names in 0002j, per R2RMLTC0002j); the expected id literal is typed xsd:integer per the SQL natural mapping - RMLTC0005a, RMLTC0005b, RMLTC0012e, RMLTC0016b: xsd:double literals use decimal notation, matching the registry convention - RMLTC0015b: references use the lowercase names produced by the unquoted DDL, as in RMLTC0015a, and the second query filters Lan = 'ES'; the only intended errors are the invalid language tags - RMLTC0019b: the table keeps only the row with the data error, as in the current JSON variant - RMLTC0002f: PostgreSQL JDBC driver and user instead of MySQL - RMLTC0004a: dropped a stray student_sport.csv from the CSV variant All resource.sql files load and all SQL2008Query iterators behave as expected on PostgreSQL 16; mappings and expected outputs parse as Turtle/N-Quads.
The PostgreSQL variant of RMLTC0001b never had the rml:termType rml:BlankNode subject since the original import into rml-core (0ff3dc8), diverging from both R2RMLTC0001b and RMLTC0001b-JSON, which generate a blank node subject as the test title states.
The PostgreSQL variant inherited from rml-core inverted the scenario of R2RMLTC0002f: the DDL used regular identifiers while the mapping referenced everything as delimited. Restore the original design: delimited identifiers in the DDL and in rml:iterator/rml:reference, regular identifiers only in the subject template, which is the non-conforming reference under test. Drop the "Within rr:template ID is ok, but Name is not" sentence from the description: it only holds under standard SQL uppercase folding, while PostgreSQL folds regular identifiers to lowercase and rejects both references. Note: RMLMapper v8.0.1 does not reject the non-conforming template and materializes output for this mapping, exactly as it does for R2RMLTC0002f.
jduchateau
left a comment
There was a problem hiding this comment.
I just quickly looked at two negative test cases I am unsure about.
| @@ -0,0 +1,49 @@ | |||
| ## RMLTC0002h-RDB | |||
|
|
|||
| **Title**: Two columns mapping, duplicate column name in SELECT | |||
There was a problem hiding this comment.
In RML-IO-Registry specs about SQL, nothing says duplicate column names are forbidden, although it was forbidden in R2RML.
There was a problem hiding this comment.
You're right. So I'd just drop this test altogether, and if you agree I'd drop https://github.com/kg-construct/rml-io-registry/tree/main/test-cases/RMLIOREGTC0005j on main too, since it does exactly the same thing
| ]; | ||
| rml:subjectMap [ | ||
| rml:class foaf:Person; | ||
| rml:template "http://example.com/{ID}/{Name}" |
There was a problem hiding this comment.
To be honest, I am not familiar enough with the subtleties of delimited identifiers and regular identifiers, so I may be completely wrong:
If I understand well, this test fails because in the template the references are not quoted, but if we look at test RMLTC0002a-RDB they are also unquoted everywhere in the mapping but created quoted, so it should fail as well?
There was a problem hiding this comment.
Also here, I think you're right and this test only makes sense in R2RML, which has a rule that references are SQL identifiers and follow the SQL comparison rules (https://www.w3.org/TR/r2rml/#dfn-sql-identifier). I don't see that in https://github.com/kg-construct/rml-io-registry/blob/main/sql/section/reference-formulation.md, which is why 0002a-RDB and the other cases doing the same thing are fine. So I'd drop 0002f, and https://github.com/kg-construct/rml-io-registry/tree/main/test-cases/RMLIOREGTC0005h with it, since it's the same test with the scenario inverted (DDL regular, mapping delimited).
This adds the 59 PostgreSQL-backed test cases that were removed from rml-core in kg-construct/rml-core@2a232cf, as discussed in kg-construct/rml-core#266
They are not a blind copy, though. I went through each case and mirrored the fixes the JSON twins received after the removal:
I also want to flag that the registry already had tests reusing the logic of the core RDB cases: most of the RMLIOREGTC0005a-z series, renumbered, so their ids don't map back to the core tests. I left them untouched here, but in my opinion they should be removed, since they are covered by the cases added in this PR and they have the wrong numbering.
Finally, these cases are already in use as the conformance suite of Knowledge Graph Inversion (https://github.com/arcangelo7/knowledge-graphs-inversion), with the expected results.