26
An Introduction to the QUIS Language Javad Chamanara University of Jena, Germany MoSD course 2016

An Itroduction to the QUIS Language

  • Upload
    javadch

  • View
    63

  • Download
    2

Embed Size (px)

Citation preview

Page 1: An Itroduction to the QUIS Language

An Introduction to the QUIS Language

Javad ChamanaraUniversity of Jena, Germany

MoSD course 2016

Page 2: An Itroduction to the QUIS Language

• Various tools– R, Matlab, …

• Various languages– SQL, Python, C, …

• Different data sources and formats– Tables, sheets, flat files, …

• Transforming data for tool integration• Similar concepts different presentations• Sharing, reproduction, …

Moti

vatio

n

Page 3: An Itroduction to the QUIS Language

To define the query in a uniform way and QUIS it Equally

on various Data Sources to have a proper Result back

Obj

ectiv

es

Page 4: An Itroduction to the QUIS Language

How it worksSE

LECT

Source Select

Operation

Filter

Persistent ContainerMemory variable

Target

Plot

Persistent ContainerMemory variableJoined

Container

Order

Group

Limit

Aggregate

Transform

Page 5: An Itroduction to the QUIS Language

The shortest query statement

SELECT FROM ds1.0Que

ryData Source:

Database, Folder, Book, graph

Data Container:Table, file, sheet, …

Page 6: An Itroduction to the QUIS Language

A statement with a Data Source

BIND ds1 CONNECTION=cnn1 SCOPE=xdata_10, udata

SELECT FROM ds1.0 INTO var1

Que

ry

Page 7: An Itroduction to the QUIS Language

A statement with a CONNECTION

CONNECTION cnn1 ADAPTER=CSV SOURCE_URI="D:\Projects\MoSD\Data\"BIND ds1 CONNECTION=cnn1 SCOPE=xdata_10, udata

SELECT FROM ds1.0 INTO var1

Que

ry

Page 8: An Itroduction to the QUIS Language

Using result sets of previous queries

CONNECTION cnn1 ADAPTER=CSV SOURCE_URI="D:\Projects\Soil\Data\"BIND ds1 CONNECTION=cnn1 SCOPE=xdata_10, udata

SELECT FROM ds1.0 INTO var1SELECT FROM var1 INTO var2 ORDER BY temp

Que

ry

Page 9: An Itroduction to the QUIS Language

Joining two files (containers)

CONNECTION cnn1 ADAPTER=CSV SOURCE_URI="D:\Projects\Soil\Data\"BIND ds1 CONNECTION=cnn1 SCOPE=data1, data2, udata

SELECT FROM ds1.data1 INNER JOIN ds1.data2 ON xk == yk INTO joined

Que

ry

Page 10: An Itroduction to the QUIS Language

Adding virtual schemas

PERSPECTIVE observation{ ATTRIBUTE Temperature: Real MapTo = 1.8 * temperature + 32, ATTRIBUTE SN: Real MapTo = soilNi / 1000,}

SELECT USING PERS observation FROM ds1.0 INTO var1

Que

ry

Page 11: An Itroduction to the QUIS Language

Hierarchical virtual schemasPERSPECTIVE location{ ATTRIBUTE Longitude: Real MapTo = longitude, ATTRIBUTE Latitude: Real MapTo = latitude, ATTRIBUTE Elevation: Real MapTo = elevation / 0.3048,}PERSPECTIVE observation EXTENDS location{ ATTRIBUTE Temperature: Real MapTo = 1.8 * temperature + 32, ATTRIBUTE SN: Real MapTo = soilNi / 1000,}SELECT USING PERSPECTIVE observation FROM ds1.0 INTO var1

Que

ry

Page 12: An Itroduction to the QUIS Language

The SELECT clausesSELECT USING PERSPECTIVE observation FROM ds1.0 INTO var1

WHERE (Temperature > 50)ORDER BY Elevation ASCLIMIT SKIP 1 TAKE 20

Que

ry

Page 13: An Itroduction to the QUIS Language

Utilizing functionsATTRIBUTE ObsTime: Date MapTo = str.toDate(obs_time, "HH:mm"),

ATTRIBUTE meanTemp: Real MapTo = avg(temperature),

SELECT USING PERS INLINE sum(rank) as tRank, employee as e FROM ds1.0 INTO var1

WHERE (math.log(math.abs(pIndex))> 3)

Que

ry

Page 14: An Itroduction to the QUIS Language

StreamingSELECT USING PERS observation FROM ds1.0

INTO ds1.1WHERE (Temperature > 50 AND Elevation >= 32 AND Elevation < 50)

Que

ry

Page 15: An Itroduction to the QUIS Language

SELECT FROM b2.0 INNER JOIN b2.1 ON PK <> FK INTO PLOT p3 hax:Elevation v-axis:R.Temperature pt:l hl:"Elevation (F)" vl:"Temperature (F)" pl:"Temperature and Elevation"

WHERE (R.Temperature > 0)ORDER BY Elevation

Que

ry

Page 16: An Itroduction to the QUIS Language

SELECT FROM b2.0 PERS PLeft INNER JOIN b2.1 PERS PRight ON PK <> FK INTO PLOT p3 hax:Elevation v-axis:R.Temperature pt:l hl:"Elevation (F)" vl:"Temperature (F)" pl:"Temperature and Elevation" WHERE (R.Temperature > 0) ORDER BY Elevation

Plot

s

Page 17: An Itroduction to the QUIS Language

RQUIS

• A package for R users• To access QUIS functionalities• To facilitate heterogeneous data access• In a unified manner• Using one langauge

Page 18: An Itroduction to the QUIS Language

library(RQUIS)library(ggplot2)library(scales)library(plyr)

Page 19: An Itroduction to the QUIS Language

engine <- quis.getEngine()

Page 20: An Itroduction to the QUIS Language

file <- system.file("extdata", "ex1.xqt", package="RQUIS")

ld <- quis.loadProcess(engine, file)

Page 21: An Itroduction to the QUIS Language

rn <- quis.runProcess(engine)err <- quis.getRunReport(engine)

Page 22: An Itroduction to the QUIS Language

data <- quis.getVariable(engine, "meanDailyTemp")

schema <- quis.getVariableSchema(engine, "meanDailyTemp")

Page 23: An Itroduction to the QUIS Language

ggplot(data, aes(dayindex, meantemp)) + geom_line() + xlab("") + ylab("Mean Temperature C°") + ggtitle("2014 Average Daily Temperature at SFO")

Page 24: An Itroduction to the QUIS Language

ggplot(data, aes(dayindex, meantemp)) + geom_line() + xlab("") + ylab("Mean Temperature C°") + ggtitle("2014 Average Daily Temperature at SFO")

10

12

14

0 10 20 30

Mea

n Te

mpe

ratu

re C

°2014 Average Daily Temperature at SFO

Page 25: An Itroduction to the QUIS Language

SELECT features FROM scope WHERE (status == implemented)

Sum

Up

Source

Data SourceVariable

Operations

ProjectionFilteringOrderingGroupingLimiting

Target

VariableData SourcePlot

Adapters

CSV/ExcelMemoryDBMS

Page 26: An Itroduction to the QUIS Language

Thanks for your attentionFe

edba

ck

Source is available at: github.com/javadchBinary is available at: http://fusion.cs.uni-jena.de/javad/quis/