SMS2 with CSV no BIND(IF....)?

We've been experimenting with CSV import using SMS2 mapping as an alternative to TARQL (http://tarql.github.io/) .

We've found however that SMS2 mappings don't seem to support BIND(IF...) expressions which makes mapping based on a decision using the column value impossible.

eg
mapping "special" values to a particular value/URI
BIND(IF( ?employmentType=1, "FULL TIME" , "PART TIME") as ?jobString),

Any plans on supporting IF in BIND?

(Apart from this issue it does appear that it could be a viable alternative to TARQL)

Hi!

This is a supported expression. What problem are you seeing?

We're finding that anywhere where we've used BIND(IF... the target variable is never resolved (ie missing from the CONSTRUCT output).
eg

BIND (IF(?CASUAL = "0" && ?FULLTIME = "0",?noemployment,
			IF(?CASUAL = "1", URI(CONCAT('http://test.org/Employment/Casual')),
			URI(CONCAT('http:/test.org/Employment/Fulltime')))) as ?emptype)

?emptype is never resolved.
(Even tried changing the test to = 0 in case it was converting the text value to a number)
All other BINDs are resolving as expected.

example of CSV

FILE,YEAR,RECID,SA1,MB,BDAY,BYEAR,SEX,INDUSTRY,CASUAL,FULLTIME,HOURS,PAYRATE,AWE
A,2011,A000001,10929,1092903,168,1954,2,4,0,0,17,35.00,595.00
A,2011,A000002,10981,1098109,26,1998,1,1,0,1,40,40.00,1600.00
A,2011,A000006,10768,1076809,168,1990,2,2,1,0,40,43.20,1728.00

Thanks for the details. We'll take a look.

Where is ?noemployment declared? Does it work if you replace that with a constant value?

?noemployment is not declared so should not be resolved (ie the triple that uses that variable in the CONSTRUCT
eg vars:employmentType ?emptype;
would not be created).
So, in the example we don't want ?emptype to resolve if both CASUAL & FULLTIME values are both 0.

Thanks. I've reproduced the issue. As a workaround, you can BIND something which creates an error, eg BIND(integer("X") as ?noemployment). We'll get this fixed shortly.

Thanks - will give that a try.

That works thanks Jess. We will use that for now :+1:

Glad it's working. Thanks again for reporting it.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.