Add UnitValue type to QueryRepresentation#219
Conversation
f1add93 to
37c45f1
Compare
3512923 to
2756f81
Compare
| return value; | ||
| } | ||
| if ( 'value' in value ) { // if value is UnitValue | ||
| return value.value; // TODO: multiply by unit, define how to manage it |
There was a problem hiding this comment.
Are we doing any unit conversion at some point??
There was a problem hiding this comment.
Yes, as it was discussed and documented, we will have two different queries depending on whether this is a unit or not.
In this specific case here I would suggest to throw an error after the first if, instead of returning a number. That is because that number will still lead to a wrong query and so it is better to fail explicitly and loudly.
The proper implementation will be done in the course of T276938.
| private buildTripleForExplicitValue( datatype: string, value: string | number ): Term { | ||
| switch ( datatype ) { | ||
| case 'string': | ||
| case 'quantity': |
There was a problem hiding this comment.
This line is probably causing the browser test failure. We still want to treat quantity as a datatype with only limited support in this pull request. We'll build the SPARQL in https://phabricator.wikimedia.org/T276938
a2ca220 to
bf2527c
Compare
1a932cb to
54a608c
Compare
35af87f to
bc048dd
Compare
…unt for unit values
bc048dd to
94a5ed6
Compare
| expect( actual ).toStrictEqual( expected ); | ||
| } ); | ||
|
|
||
| it( 'with quantity value', () => { |
There was a problem hiding this comment.
added this test to pass sonarcloud!!
| expect( actual ).toStrictEqual( expected ); | ||
| } ); | ||
|
|
||
| it( 'with quantity value', () => { |
Co-authored-by: Michael Große <michael.grosse@wikimedia.de>
|
Kudos, SonarCloud Quality Gate passed! |
…unt for unit values