+ All Categories
Home > Documents > DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad...

DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad...

Date post: 15-Jul-2020
Category:
Upload: others
View: 5 times
Download: 0 times
Share this document with a friend
27
DataReceiver and SchemaMapper Peter Laulund - Agency for Data Supply and Efficiency
Transcript
Page 1: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

DataReceiver and SchemaMapperPeter Laulund - Agency for Data Supply and Efficiency

Page 2: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

AbstractAt SDFE we are working on a project, where we have to import up to100 feature types in a number of formats into Oracle, using FME andFMEServer. In order to manage this, we have created one workspacethat handle all datasets and formats, a key to this is theSchemaMapper. The SchemaMapper is a transformer with a badreputation, but as I will show it a flexible and dynamic transformer whenyou use it in combination with a database. I will also demonstrate howwe can use an expression as part of the schema mapping. In mypresentation I will discuss this project with special focus on theSchemaMapper.

Page 3: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

About me

• Working with FME since 1997• Working with FMEServer since 2001• Certified professional• Works at SDFE (KMS, GST)

Page 4: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

Favorite transformers

Page 5: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

SDFE and FME

• We use FME and FMEServer• Major projects

• Kortforsyningen.download.dk• INSPIRE• Transportbåndet

• Datamodtagelsen / DataReceiver

Page 6: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

DataReceiver

Page 7: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

DataReceiver

• Up to +100 feature types• Any input format -> Oracle spatial

• Mapinfo, Shape, FFS, GML, CSV, XLS, ….

• Any coordinate system -> EPSG:25832• Action: Total, Replace, Synchronize and

Delta

Page 8: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

The challenge

• One workspace that handles all featuretypes

• Documenting the translation

Page 9: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

PL/SQL

Infrastructure

JMSPollingService

File area

FMEServerSFTP

Log

Log

Staging Test Prod

admin.web

Page 10: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

PL/SQL

main.fmw

FMEServer

Log

Stagingload2oracle.fmwFile area

successerrormail

jms / json

FMEServer

Page 11: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

main.fmw

{ "jms_publisher_content" : {"dm_jobid" : 10116,"prs_id" : 1,"filepath" : "c00016/00000000013","seq_nbr" : "13","cha_id" : 16,"prior_seq" : 12,"prs_name" : "load"

},"jms_publisher_type" : "text","fns_type" : "jms_publisher"}

Page 12: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

load2oracle.fmw

Page 13: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

load2oracle.fmw - Reader

Page 14: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

SchemaMapper

Page 15: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

Actually, I think the SchemaMappercould use some love, it feels a bitclunky compared to other and morerecent additions in FME

david_r on FME Community

Page 16: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

The SchemaMapper transformercan be very handy but it definitelyhas it's limitations and it feels likeit's getting a bit long in the tooth

nic_ran on FME Community

Page 17: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

SchemaMapper functionality

• Filter incoming features• Rename attribute• Add an attribute with default value• Default can be an expression• Attribute lookup with filter

Page 18: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in
Page 19: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

SchemaMapper configurationFilter Value Old Attr New Attr Default

fme_feature_type tower name MASTENUMMER

fme_feature_type tower sdfe_timestamp REGISTRERINGFRA

fme_feature_type tower profile MASTETYPE unknown

fme_feature_type tower towerheight MASTEHOEJDE -1

fme_feature_type tower ID_LOKALID @UUID()

fme_feature_type tower ID_NAMESPACE data.gov.dk\Højspændingsnet\Elmast

fme_feature_type tower sdfe_feature_type ELMAST

fme_feature_type tower sdfe_geom_coordsys EPSG:25832

fme_feature_type tower SENESTEREVISION @DateTimeParse(@Value(extpub_dato)),ISO)

fme_feature_type tower STATUS @LowerCase(@Value(tatus))

Page 20: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

Attribut Expresion ValueAREA @Area() 10000

LENGTH @Length() 400

UUID @UUid() d5c31968-a5e0-4b90-8967-8b716df34d2e

EVALUATE @Evaluate(@Value(AREA) * @Value(LENGTH)) 4000000

CONCATENATE @Concatenate(area is, @Value(AREA), \,and length is,@Value(LENGTH))

area is 10000 ,and length is 400

A @Value(A) Hello world

TCL @Tcl2(myProc) Hello Peter

COORDSYS @CoordSys() EPSG:25832

GEOM_IS_VALID @OGCGeometry(is_valid) True

NOW @DateTimeNow() 20190227163039.4223444

UPPER @UpperCase(@Value(A)) HELLO WORLD

SchemaMapper and functions

Page 21: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

String and date functions

• @LowerCase(), @DateTimeNow()• @EvaluateExpression(<expression>)• Expression must be WWJD encoded• Use a PL/SQL function in a view to do

the encoding

Page 22: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

WWJD encoding in OracleCREATE FUNCTION fme_encode( i_s in varchar2 )RETURN varchar2 IS

s varchar2(4000) ;BEGIN

s := replace(i_s, '<', ‘<lt>' ) ;s := replace(s, '>', '<gt>' ) ;………s := replace(s, q'{'}', '<apos>' ) ;s := '@EvaluateExpression(unused1,' || s || ',unused2)' ;return s;

END;

@EvaluateExpression(unused1,<at>LowerCase<openparen><at>Value<openparen>sportype<closeparen><closeparen>

, unused2)

DECODE(ENCODE, 1, DM_ADM.FME_ENCODE(DEFAULT_VAL), DEFAULT_VAL) DEFAULT_VAL

Page 23: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

FUNCTION fme_encode( i_s in varchar2 ) RETURN varchar2IS

s varchar2(4000) ;BEGIN

s := replace(i_s, '<', ':lt:' ) ;s := replace(s, '>', '<gt>' ) ;s := replace(s, ':lt:', '<lt>' ) ;s := replace(s, '(', '<openparen>' ) ;s := replace(s, ')', '<closeparen>' ) ;s := replace(s, '{', '<opencurly>' ) ;s := replace(s, '}', '<closecurly>' ) ;s := replace(s, '[', '<openbracket>' ) ;s := replace(s, ']', '<closebracket>' ) ;s := replace(s, '$', '<dollar>' ) ;s := replace(s, '@', '<at>' ) ;s := replace(s, ' ', '<space>' ) ;s := replace(s, ';', '<semicolon>' ) ;s := replace(s, ',', '<comma>' ) ;s := replace(s, '"', '<quote>' ) ;s := replace(s, '/', '<solidus>' ) ;s := replace(s, '\', '<backslash>' ) ;s := replace(s, q'{'}', '<apos>' ) ;s := '@EvaluateExpression(unused1,' || s || ',unused2)' ;return s;

END;

Page 24: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

SchemaMapper

• Metadata in a database• Use Where when reading• Map metadata with a view• Expressions as default value• Encode functions in view

Page 25: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

Summary

Page 26: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

• FME is an key part of our infrastructure• One FME project• Metadata document the mapping• Functions in SchemaMapper• I love SchemaMapper:-}

Page 27: DataReceiver and SchemaMapper · SchemaMapper. The SchemaMapper is a transformer with a bad reputation, but as I will show it a flexible and dynamic transformer when you use it in

QuestionsPeter Laulund – [email protected]


Recommended