No Size Fits All – Running the Star Schema Benchmark with SPARQL and RDF Aggregate Views

Benchmark Document 12 December 2012

Editors:
Benedikt Kämpgen, Institute AIFB, Karlsruhe Institute of Technology
Andreas Harth, Institute AIFB, Karlsruhe Institute of Technology

Abstract

Goal of this document: This document shall allow reproducing the benchmark described in the paper: Benedikt Kämpgen, Andreas Harth. No Size Fits All – Running the Star Schema Benchmark with SPARQL and RDF Aggregate Views. ESWC 2013, LNCS 7882, Seiten: 290-304, Springer, Heidelberg, Mai, 2013.

Abstract of paper: Statistics published as Linked Data promise efficient extraction, transformation and loading (ETL) into a database for decision support. The predominant way to implement analytical query capabilities in industry are specialised engines that translate OLAP queries to SQL queries on a relational database using a star schema (ROLAP). A more direct approach than ROLAP is to load Statistical Linked Data into an RDF store and to answer OLAP queries using SPARQL. However, we assume that general-purpose triple stores - just as typical relational databases - are no perfect fit for analytical workloads and need to be complemented by OLAP-to-SPARQL engines. To give an empirical argument for the need of such an engine, we first compare the performance of our generated SPARQL and of ROLAP SQL queries. Second, we measure the performance gain of RDF aggregate views that, similar to aggregate tables in ROLAP, materialise parts of the data cube.

Research questions: 1) evaluating OLAP-to-SPARQL approach [KRH2012] and 2) evaluating the performance gain of RDF aggregate views.

Status of This Document

This document is part of a final submission to the ESWC 2013 Semantic Data Management track.

Table of Contents

1. Overview of Tested Approaches

The following table gives an overview of tested approaches in this benchmark.

Note, we are listing the approach of using a common ROLAP engine, Mondrian, (ROLAP) that has not been included in the paper since its test results were similar to the results of purely using a relational database (RDBMS). ROLAP demonstrates well the function of an OLAP engine (ROLAP in this case) to translate an OLAP query (MDX in this case) into a query to a database (SQL in this case), which is why we have included it, here.

Table: Overview of approaches, including the time for pre-processing needed and rows/triples created
Name Data Format Metadata Query Language Engine/Database Pre-processing (s) Rows/Triples
RDBMS Relational - SQL MySQL 22 6,234,555
ROLAP Relational XML SQL MySQL, Mondrian 22 6,234,555
ROLAP-M Relational XML SQL MySQL, Mondrian 4,507 14,975,472
OLAP4LD-SSB Graph-based - SPARQL Open Virtuoso 5,352 108,021,078
OLAP4LD-QB Graph-based RDF/QB SPARQL Open Virtuoso 5,744 116,832,479
OLAP4LD-QB-M Graph-based RDF/QB SPARQL Open Virtuoso 26,032 190,060,632

2. Star Schema Benchmark

In the following, we describe the Star Schema Benchmark (SSB) [SSB2009] that has been chosen as a benchmark for the paper. We first describe the schema and the data, then we describe all queries as OLAP queries and then we describe all closest views to these OLAP queries.

2.1 Schema and Data

The following figure illustrates the schema of SSB. SSB describes exactly one data cube "lineorder". The figure also shows in brackets the number of facts in the data cube, the number of members for each dimension, and the number of members on each of the higher levels:

SSB Schema
Figure: Star Schema Benchmark Schema

The following figure illustrates the hierarchies in more detail:

SSB Hierarchies
Figure: Star Schema Benchmark Hierarchies

In the following, we list all measures and their aggregation functions:

2.2 SSB Queries as OLAP Queries

SSB provides a workload of 13 queries on the data cube. We have described each SSB query as an OLAP query as defined in the paper. Since we always query the same data cube "lineorder", we omit the cube from the query.

Q1

This query flight is meant to quantify the amount of revenue increase that would have resulted from eliminating certain company- wide discounts in a given percentage range for products shipped in a given year.

Q2

This query flight compares revenue for some product classes, for suppliers in a certain region, grouped by more restrictive product classes and all years of orders.

Q3

This query flight intends to provide revenue volume for lineorder transactions by customer nation and supplier nation and year within a given region, in a certain time period.

Q4

This query flight represents a "What-If" sequence, of the OLAP type. Here, we investigate the profit for customers and suppliers from America of specific product classes over all years of orders.

For that, first, assume that in the Q4.1 output we find a surprising growth of 40% in profit from year 1997 to year 1998, uniform across c_nationLevel (this need not be true in the data we actually examine). We would probably want to pivot to group by year, s_nationLevel and a further breakdown by p_categoryLevel to see where the change arises.

And second, assume that as a result of Q4.2, a great percentage of the profit increase from year 1997 to 1998 comes from s_nation = 'UNITED STATES' and p_category = 'MFGR1#4'. Now we might want to drill down to cities in the United States and into p_brand1 (within p_category).

2.3 Closest Views to SSB Queries as OLAP Queries

For any SSB query, we can determine one "closest" view in the lattice from which we can create the results by a single scan through the results without any more aggregations. See in the following list the closest view for each SSB query.

The amount of space required for each view is given by the number of tuples in a view. The number of tuples from any view can be computed by multiplying the number of members for each of the non-sliced levels. For instance, Q2.3 contains for a scale of one maximum 7 (yearLevel) * 1,000 (brand1Level) * 5 (s_regionLevel) = 35,000 results. In brackets we add the maximum number of facts per view versus the actual number of facts due to sparseity.

Q1

Q2

Q3

Q4

2.4 Metrics

In this section, we describe the general setup of all tests to answer our research questions:

3. Approaches

For each of the approaches, we list the queries. Also, we give additional information about the preparations for each test, e.g., the command for running the approach using BIBM, the necessary tools and generated files, the preparation time and size in rows/triples as well as the qualification file with the results. Necessary files are linked from the specific descriptions and can also be browsed from here.

3.1 RDBMS

BIBM command:
java -classpath .:* com.openlinksw.bibm.tpch.TestDriver -uc ../ssb/mysql -q -defaultparams -mt 1 -scale 1 -dbdriver com.mysql.jdbc.Driver -sql jdbc:mysql://localhost/ssb1?user=root
Tools: MySQL settings:
#
# * Fine Tuning
#
key_buffer              = 16M
max_allowed_packet      = 16M
thread_stack            = 192K
thread_cache_size       = 8

#
# * Query Cache Configuration
#
query_cache_limit       = 0M
query_cache_size        = 0M
Data generator settings:
CC = gcc; DATABASE = SQLSERVER; MASCHINE = LINUX; WORKLOAD = SSBM
Data generator command:
./dbgen -s 1 -T a
Files: Preparation time: Rows/Triples: Results: We now list all queries:

3.1.1 RDBMS Q1.1 (1)

select 
    sum(lo_extendedprice*lo_discount) as revenue
from 
    lineorder, dates
where 
    lo_orderdate = d_datekey
    and d_year = 1993
    and lo_discount between 1 and 3
    and lo_quantity < 25;

3.1.2 RDBMS Q1.2 (2)

select 
    sum(lo_extendedprice*lo_discount) as revenue
from 
    lineorder, dates
where 
    lo_orderdate = d_datekey
    and d_yearmonthnum = 199401
    and lo_discount between 4 and 6
    and lo_quantity between 26 and 35;

3.1.3 RDBMS Q1.3 (3)

select 
    sum(lo_extendedprice*lo_discount) as revenue
from 
    lineorder, dates
where 
    lo_orderdate = d_datekey
    and d_weeknuminyear = 6
    and d_year = 1994
    and lo_discount between 5 and 7
    and lo_quantity between 26 and 35;

3.1.4 RDBMS Q2.1 (4)

select 
    sum(lo_revenue) as lo_revenue, d_year, p_brand1
from 
    lineorder, dates, part, supplier
where 
    lo_orderdate = d_datekey
    and lo_partkey = p_partkey
    and lo_suppkey = s_suppkey
    and p_category = 'MFGR#12'
    and s_region = 'AMERICA'
group by 
    d_year, p_brand1
order by 
    d_year, p_brand1;

3.1.5 RDBMS Q2.2 (5)

select 
    sum(lo_revenue) as lo_revenue, d_year, p_brand1
from 
    lineorder, dates, part, supplier
where 
    lo_orderdate = d_datekey
    and lo_partkey = p_partkey
    and lo_suppkey = s_suppkey
    and p_brand1 between 'MFGR#2221' and 'MFGR#2228'
    and s_region = 'ASIA'
group by 
    d_year, p_brand1
order by 
    d_year, p_brand1;

3.1.6 RDBMS Q2.3 (6)

select 
    sum(lo_revenue) as lo_revenue, d_year, p_brand1
from 
    lineorder, dates, part, supplier
where 
    lo_orderdate = d_datekey
    and lo_partkey = p_partkey
    and lo_suppkey = s_suppkey
    and p_brand1 = 'MFGR#2239'
    and s_region = 'EUROPE'
group by 
    d_year, p_brand1
order by 
    d_year, p_brand1;

3.1.7 RDBMS Q3.1 (7)

select 
    c_nation, s_nation, d_year,
    sum(lo_revenue) as lo_revenue
from 
    customer, lineorder, supplier, dates
where 
    lo_custkey = c_custkey
    and lo_suppkey = s_suppkey
    and lo_orderdate = d_datekey
    and c_region = 'ASIA'
    and s_region = 'ASIA'
    and d_year >= 1992 and d_year <= 1997
group by 
    c_nation, s_nation, d_year
order by 
    d_year asc, lo_revenue desc;

3.1.8 RDBMS Q3.2 (8)

select 
    c_city, s_city, d_year, sum(lo_revenue) as lo_revenue
from 
    customer, lineorder, supplier, dates
where 
    lo_custkey = c_custkey
    and lo_suppkey = s_suppkey
    and lo_orderdate = d_datekey
    and c_nation = 'UNITED STATES'
    and s_nation = 'UNITED STATES'
    and d_year >= 1992 and d_year <= 1997
group by 
    c_city, s_city, d_year
order by 
    d_year asc, lo_revenue desc;

3.1.9 RDBMS Q3.3 (9)

select 
    c_city, s_city, d_year, sum(lo_revenue) as lo_revenue
from 
    customer, lineorder, supplier, dates
where 
    lo_custkey = c_custkey
    and lo_suppkey = s_suppkey
    and lo_orderdate = d_datekey
    and (c_city='UNITED KI1' or c_city='UNITED KI5')
    and (s_city='UNITED KI1' or s_city='UNITED KI5')
    and d_year >= 1992 and d_year <= 1997
group by 
    c_city, s_city, d_year
order by 
    d_year asc, lo_revenue desc;

3.1.10 RDBMS Q3.4 (10)

select 
    c_city, s_city, d_year, sum(lo_revenue) as lo_revenue
from 
    customer, lineorder, supplier, dates
where 
    lo_custkey = c_custkey
    and lo_suppkey = s_suppkey
    and lo_orderdate = d_datekey
    and (c_city='UNITED KI1' or c_city='UNITED KI5')
    and (s_city='UNITED KI1' or s_city='UNITED KI5')
    and d_yearmonth = 'Dec1997'
group by 
    c_city, s_city, d_year
order by 
    d_year asc, lo_revenue desc;

3.1.11 RDBMS Q4.1 (11)

select 
    d_year, c_nation,
    sum(lo_revenue - lo_supplycost) as profit
from 
    dates, customer, supplier, part, lineorder
where 
    lo_custkey = c_custkey
    and lo_suppkey = s_suppkey
    and lo_partkey = p_partkey
    and lo_orderdate = d_datekey
    and c_region = 'AMERICA'
    and s_region = 'AMERICA'
    and (p_mfgr = 'MFGR#1' or p_mfgr = 'MFGR#2')
group by 
    d_year, c_nation
order by 
    d_year, c_nation;

3.1.12 RDBMS Q4.2 (12)

select 
    d_year, s_nation, p_category,
    sum(lo_revenue - lo_supplycost) as profit
from 
    dates, customer, supplier, part, lineorder
where 
    lo_custkey = c_custkey
    and lo_suppkey = s_suppkey
    and lo_partkey = p_partkey
    and lo_orderdate = d_datekey
    and c_region = 'AMERICA'
    and s_region = 'AMERICA'
    and (d_year = 1997 or d_year = 1998)
    and (p_mfgr = 'MFGR#1' or p_mfgr = 'MFGR#2')
group by 
    d_year, s_nation, p_category
order by 
    d_year, s_nation, p_category;

3.1.13 RDBMS Q4.3 (13)

select 
    d_year, s_city, p_brand1,
    sum(lo_revenue - lo_supplycost) as profit
from 
    dates, customer, supplier, part, lineorder
where 
    lo_custkey = c_custkey
    and lo_suppkey = s_suppkey
    and lo_partkey = p_partkey
    and lo_orderdate = d_datekey
    and c_region = 'AMERICA'
    and s_nation = 'UNITED STATES'
    and (d_year = 1997 or d_year = 1998)
    and p_category = 'MFGR#14'
group by 
    d_year, s_city, p_brand1
order by 
    d_year, s_city, p_brand1;

3.2 ROLAP

BIBM command:
java -classpath .:* com.openlinksw.bibm.tpch.TestDriver -uc ../ssb/mondrianSQL -q -defaultparams -mt 1 -scale 1 -dbdriver com.mysql.jdbc.Driver -sql jdbc:mysql://localhost/ssb1?user=root
Tools: Files: Preparation time: Rows/Triples: Results: We first list all SSB queries as MDX queries. Mondrian translates these MDX queries into corresponding SQL queries as listed, afterwards:

3.2.1 MDX Q1.1 (1)

SELECT {[Measures].[Sum Revenue]} ON COLUMNS,
{[dates].[d_year].[1993]} ON ROWS
FROM [SSB]
WHERE CrossJoin(
	Filter([lo_discount].[lo_discount].members, Cast([lo_discount].currentmember.name as NUMERIC) >= 1 and Cast([lo_discount].currentmember.name as NUMERIC) <= 3),
	Filter([lo_quantity].[lo_quantity].members, Cast([lo_quantity].currentmember.name as NUMERIC) < 25)
)

3.2.2 MDX Q1.2 (2)

SELECT {[Measures].[Sum Revenue]} ON COLUMNS,
{[dates].[d_yearmonthnum].[199401]} ON ROWS
FROM [SSB]
WHERE CrossJoin(
	Filter([lo_discount].[lo_discount].members, Cast([lo_discount].currentmember.name as NUMERIC) >= 4 and Cast([lo_discount].currentmember.name as NUMERIC) <= 6),
	Filter([lo_quantity].[lo_quantity].members, Cast([lo_quantity].currentmember.name as NUMERIC) >= 26 and Cast([lo_quantity].currentmember.name as NUMERIC) <= 35)
)

3.2.3 MDX Q1.3 (3)

SELECT {[Measures].[Sum Revenue]} ON COLUMNS,
{([dates].[d_year].[1994], [d_weeknuminyear].[6])} ON ROWS
FROM [SSB]
WHERE CrossJoin(
	Filter([lo_discount].[lo_discount].members, Cast([lo_discount].currentmember.name as NUMERIC) >= 5 and Cast([lo_discount].currentmember.name as NUMERIC) <= 7),
	Filter([lo_quantity].[lo_quantity].members, Cast([lo_quantity].currentmember.name as NUMERIC) >= 26 and Cast([lo_quantity].currentmember.name as NUMERIC) <= 35)
)

3.2.4 MDX Q2.1 (4)

SELECT {[Measures].[Sum lo_revenue]} ON COLUMNS,
{Crossjoin([dates].[d_year].members, [part].[part.default].[p_category].[MFGR#12].children)} ON ROWS
FROM [SSB]
WHERE [supplier].[s_region].[AMERICA]

3.2.5 MDX Q2.2 (5)

SELECT {[Measures].[Sum lo_revenue]} ON COLUMNS,
{Crossjoin([dates].[d_year].members, {[part].[p_brand1].[MFGR#2221], [part].[p_brand1].[MFGR#2222], [part].[p_brand1].[MFGR#2223], [part].[p_brand1].[MFGR#2224], [part].[p_brand1].[MFGR#2225], [part].[p_brand1].[MFGR#2226], [part].[p_brand1].[MFGR#2227], [part].[p_brand1].[MFGR#2228]})} ON ROWS
FROM [SSB]
WHERE [supplier].[s_region].[ASIA]

3.2.6 MDX Q2.3 (6)

SELECT {[Measures].[Sum lo_revenue]} ON COLUMNS,
{Crossjoin([dates].[d_year].members, {[part].[p_brand1].[MFGR#2239]})} ON ROWS
FROM [SSB]
WHERE [supplier].[s_region].[EUROPE]

3.2.7 MDX Q3.1 (7)

SELECT {[Measures].[Sum lo_revenue]} ON COLUMNS,
Crossjoin([customer].[c_region].[ASIA].children, Crossjoin([supplier].[s_region].[ASIA].children, 
FILTER([dates].[d_year].members, Cast([dates].[d_year].currentmember.name as NUMERIC) >= 1992 and Cast([dates].[d_year].currentmember.name as NUMERIC) <= 1997))) ON ROWS
FROM [SSB]

    

3.2.8 MDX Q3.2 (8)

SELECT {[Measures].[Sum lo_revenue]} ON COLUMNS,
Crossjoin([customer].[c_nation].[UNITED STATES].children, Crossjoin([supplier].[s_nation].[UNITED STATES].children, 
FILTER([dates].[d_year].members, Cast([dates].[d_year].currentmember.name as NUMERIC) >= 1992 and Cast([dates].[d_year].currentmember.name as NUMERIC) <= 1997))) ON ROWS
FROM [SSB]

    

3.2.9 MDX Q3.3 (9)

SELECT {[Measures].[Sum lo_revenue]} ON COLUMNS,
Crossjoin({[customer].[c_city].[UNITED KI1], [customer].[c_city].[UNITED KI5]}, Crossjoin({[supplier].[s_city].[UNITED KI1], [supplier].[s_city].[UNITED KI5]}, 
FILTER([dates].[d_year].members, Cast([dates].[d_year].currentmember.name as NUMERIC) >= 1992 and Cast([dates].[d_year].currentmember.name as NUMERIC) <= 1997))) ON ROWS
FROM [SSB]

    

3.2.10 MDX Q3.4 (10)

SELECT {[Measures].[Sum lo_revenue]} ON COLUMNS,
Crossjoin({[customer].[c_city].[UNITED KI1], [customer].[c_city].[UNITED KI5]}, Crossjoin({[supplier].[s_city].[UNITED KI1], [supplier].[s_city].[UNITED KI5]}, 
{[dates].[d_yearmonth].[Dec1997]})) ON ROWS
FROM [SSB]
 

3.2.11 MDX Q4.1 (11)

WITH MEMBER [Measures].[Profit] as '[Measures].[Sum lo_revenue] - [Measures].[Sum lo_supplycost]'    
SELECT {[Measures].[Sum Profit]} ON COLUMNS,
CrossJoin([customer].[c_region].[AMERICA].children, [dates].[d_year].members) ON ROWS
FROM [SSB]
WHERE CrossJoin({[part].[p_mfgr].[MFGR#1], [part].[p_mfgr].[MFGR#2]}, [supplier].[s_region].[AMERICA])

3.2.12 MDX Q4.2 (12)

SELECT {[Measures].[Sum Profit]} ON COLUMNS,
CrossJoin({[dates].[d_year].[1997], [dates].[d_year].[1998]}, Crossjoin([supplier].[s_region].[AMERICA].children, Filter([part].[p_category].members, [part].currentmember.parent.name = "MFGR#1" OR [part].currentmember.parent.name = "MFGR#2"))) ON ROWS
FROM [SSB]
WHERE [customer].[c_region].[AMERICA]

3.2.13 MDX Q4.3 (13)

SELECT {[Measures].[Sum Profit]} ON COLUMNS,
CrossJoin({[dates].[d_year].[1997], [dates].[d_year].[1998]}, Crossjoin([supplier].[s_nation].[UNITED STATES].children, [part].[p_category].[MFGR#14].children)) ON ROWS
FROM [SSB]
WHERE [customer].[c_region].[AMERICA]
We now list all SQL queries that Mondrian issues to the relational database:

3.2.14 ROLAP Q1.1 (1)

select `dates`.`d_year` as `c0`, 
`lineorder`.`lo_quantity` as `c1`, 
`lineorder`.`lo_discount` as `c2`, 
sum(lo_extendedprice * lo_discount) as `m0` 

from `dates` as `dates`, `lineorder` as `lineorder` 

where `lineorder`.`lo_orderdate` = `dates`.`d_datekey` and 
`dates`.`d_year` = 1993 and 
`lineorder`.`lo_quantity` in (1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0) and 
`lineorder`.`lo_discount` in (1.0, 2.0, 3.0) 

group by `dates`.`d_year`, `lineorder`.`lo_quantity`, `lineorder`.`lo_discount`

3.2.15 ROLAP Q1.2 (2)

select 
`dates`.`d_year` as `c0`, 
`dates`.`d_yearmonth` as `c1`, 
`dates`.`d_yearmonthnum` as `c2`, 
`lineorder`.`lo_quantity` as `c3`, 
`lineorder`.`lo_discount` as `c4`, 
sum(lo_extendedprice * lo_discount) as `m0` 

from `dates` as `dates`, `lineorder` as `lineorder` 

where `lineorder`.`lo_orderdate` = `dates`.`d_datekey` and 
`dates`.`d_year` = 1994 and 
`dates`.`d_yearmonth` = 'Jan1994' and 
`dates`.`d_yearmonthnum` = 199401 and 
`lineorder`.`lo_quantity` in (26.0, 27.0, 28.0, 29.0, 30.0, 31.0, 32.0, 33.0, 34.0, 35.0) and 
`lineorder`.`lo_discount` in (4.0, 5.0, 6.0);

3.2.16 ROLAP Q1.3 (3)

select `dates`.`d_year` as `c0`, 
`dates`.`d_weeknuminyear` as `c1`, 
`lineorder`.`lo_quantity` as `c2`, 
`lineorder`.`lo_discount` as `c3`, 
sum(lo_extendedprice * lo_discount) as `m0` 

from `dates` as `dates`, `lineorder` as `lineorder` 

where `lineorder`.`lo_orderdate` = `dates`.`d_datekey` and 
`dates`.`d_year` = 1994 and 
`dates`.`d_weeknuminyear` = 6 and 
`lineorder`.`lo_quantity` in (26.0, 27.0, 28.0, 29.0, 30.0, 31.0, 32.0, 33.0, 34.0, 35.0) and 
`lineorder`.`lo_discount` in (5.0, 6.0, 7.0) ;

3.2.17 ROLAP Q2.1 (4)

select `dates`.`d_year` as `c0`, 
`part`.`p_mfgr` as `c1`, 
`part`.`p_category` as `c2`, 
`part`.`p_brand1` as `c3`, 
`supplier`.`s_region` as `c4`, 
sum(`lineorder`.`lo_revenue`) as `m0` 

from `dates` as `dates`, `lineorder` as `lineorder`, `part` as `part`, `supplier` as `supplier` 

where `lineorder`.`lo_orderdate` = `dates`.`d_datekey` and 
`lineorder`.`lo_partkey` = `part`.`P_PARTKEY` and 
`part`.`p_mfgr` = 'MFGR#1' and 
`part`.`p_category` = 'MFGR#12' and 
`part`.`p_brand1` in ('MFGR#121', 'MFGR#1210', 'MFGR#1211', 'MFGR#1212', 'MFGR#1213', 'MFGR#1214', 'MFGR#1215', 'MFGR#1216', 'MFGR#1217', 'MFGR#1218', 'MFGR#1219', 'MFGR#122', 'MFGR#1220', 'MFGR#1221', 'MFGR#1222', 'MFGR#1223', 'MFGR#1224', 'MFGR#1225', 'MFGR#1226', 'MFGR#1227', 'MFGR#1228', 'MFGR#1229', 'MFGR#123', 'MFGR#1230', 'MFGR#1231', 'MFGR#1232', 'MFGR#1233', 'MFGR#1234', 'MFGR#1235', 'MFGR#1236', 'MFGR#1237', 'MFGR#1238', 'MFGR#1239', 'MFGR#124', 'MFGR#1240', 'MFGR#125', 'MFGR#126', 'MFGR#127', 'MFGR#128', 'MFGR#129') and 
`lineorder`.`lo_suppkey` = `supplier`.`S_SUPPKEY` and 
`supplier`.`s_region` = 'AMERICA' 

group by `dates`.`d_year`, `part`.`p_mfgr`, `part`.`p_category`, `part`.`p_brand1`;

3.2.18 ROLAP Q2.2 (5)

select `dates`.`d_year` as `c0`, 
`part`.`p_mfgr` as `c1`, 
`part`.`p_category` as `c2`, 
`part`.`p_brand1` as `c3`, 
`supplier`.`s_region` as `c4`, 
sum(`lineorder`.`lo_revenue`) as `m0` 

from `dates` as `dates`, `lineorder` as `lineorder`, `part` as `part`, `supplier` as `supplier` 

where `lineorder`.`lo_orderdate` = `dates`.`d_datekey` and 
`lineorder`.`lo_partkey` = `part`.`P_PARTKEY` and 
`part`.`p_mfgr` = 'MFGR#2' and 
`part`.`p_category` = 'MFGR#22' and 
`part`.`p_brand1` in ('MFGR#2221', 'MFGR#2222', 'MFGR#2223', 'MFGR#2224', 'MFGR#2225', 'MFGR#2226', 'MFGR#2227', 'MFGR#2228') and 
`lineorder`.`lo_suppkey` = `supplier`.`S_SUPPKEY` and 
`supplier`.`s_region` = 'ASIA' 

group by `dates`.`d_year`, `part`.`p_mfgr`, `part`.`p_category`, `part`.`p_brand1`;

3.2.19 ROLAP Q2.3 (6)

select `dates`.`d_year` as `c0`, 
`part`.`p_mfgr` as `c1`, 
`part`.`p_category` as `c2`, 
`part`.`p_brand1` as `c3`, 
`supplier`.`s_region` as `c4`, 
sum(`lineorder`.`lo_revenue`) as `m0` 

from `dates` as `dates`, `lineorder` as `lineorder`, `part` as `part`, `supplier` as `supplier` 

where `lineorder`.`lo_orderdate` = `dates`.`d_datekey` and 
`lineorder`.`lo_partkey` = `part`.`P_PARTKEY` and 
`part`.`p_mfgr` = 'MFGR#2' and 
`part`.`p_category` = 'MFGR#22' and 
`part`.`p_brand1` = 'MFGR#2239' and 
`lineorder`.`lo_suppkey` = `supplier`.`S_SUPPKEY` and 
`supplier`.`s_region` = 'EUROPE' 

group by `dates`.`d_year`, `part`.`p_mfgr`, `part`.`p_category`, `part`.`p_brand1`;

3.2.20 ROLAP Q3.1 (7)

select `dates`.`d_year` as `c0`, 
`customer`.`c_region` as `c1`, 
`customer`.`c_nation` as `c2`, 
`supplier`.`s_region` as `c3`, 
`supplier`.`s_nation` as `c4`, 
sum(`lineorder`.`lo_revenue`) as `m0` 

from `dates` as `dates`, `lineorder` as `lineorder`, `customer` as `customer`, `supplier` as `supplier` 

where `lineorder`.`lo_orderdate` = `dates`.`d_datekey` and 
`lineorder`.`lo_custkey` = `customer`.`C_CUSTKEY` and 
`customer`.`c_region` = 'ASIA' and 
`customer`.`c_nation` in ('CHINA', 'INDIA', 'INDONESIA', 'JAPAN', 'VIETNAM') and 
`lineorder`.`lo_suppkey` = `supplier`.`S_SUPPKEY` and 
`supplier`.`s_region` = 'ASIA' and 
`supplier`.`s_nation` in ('CHINA', 'INDIA', 'INDONESIA', 'JAPAN', 'VIETNAM') 

group by `dates`.`d_year`, `customer`.`c_region`, `customer`.`c_nation`, `supplier`.`s_region`, `supplier`.`s_nation`;

3.2.21 ROLAP Q3.2 (8)

select `dates`.`d_year` as `c0`, 
`customer`.`c_region` as `c1`, 
`customer`.`c_nation` as `c2`, 
`customer`.`c_city` as `c3`, 
`supplier`.`s_region` as `c4`, 
`supplier`.`s_nation` as `c5`, 
`supplier`.`s_city` as `c6`, 
sum(`lineorder`.`lo_revenue`) as `m0` 

from `dates` as `dates`, `lineorder` as `lineorder`, `customer` as `customer`, `supplier` as `supplier` 

where `lineorder`.`lo_orderdate` = `dates`.`d_datekey` and 
`lineorder`.`lo_custkey` = `customer`.`C_CUSTKEY` and 
`customer`.`c_region` = 'AMERICA' and 
`customer`.`c_nation` = 'UNITED STATES' and 
`customer`.`c_city` in ('UNITED ST0', 'UNITED ST1', 'UNITED ST2', 'UNITED ST3', 'UNITED ST4', 'UNITED ST5', 'UNITED ST6', 'UNITED ST7', 'UNITED ST8', 'UNITED ST9') and 
`lineorder`.`lo_suppkey` = `supplier`.`S_SUPPKEY` and 
`supplier`.`s_region` = 'AMERICA' and 
`supplier`.`s_nation` = 'UNITED STATES' and 
`supplier`.`s_city` in ('UNITED ST0', 'UNITED ST1', 'UNITED ST2', 'UNITED ST3', 'UNITED ST4', 'UNITED ST5', 'UNITED ST6', 'UNITED ST7', 'UNITED ST8', 'UNITED ST9') 

group by `dates`.`d_year`, `customer`.`c_region`, `customer`.`c_nation`, `customer`.`c_city`, `supplier`.`s_region`, `supplier`.`s_nation`, `supplier`.`s_city`;

3.2.22 ROLAP Q3.3 (9)

select `dates`.`d_year` as `c0`, 
`customer`.`c_region` as `c1`, 
`customer`.`c_nation` as `c2`, 
`customer`.`c_city` as `c3`, 
`supplier`.`s_region` as `c4`, 
`supplier`.`s_nation` as `c5`, 
`supplier`.`s_city` as `c6`, 
sum(`lineorder`.`lo_revenue`) as `m0` 

from `dates` as `dates`, `lineorder` as `lineorder`, `customer` as `customer`, `supplier` as `supplier` 

where `lineorder`.`lo_orderdate` = `dates`.`d_datekey` and 
`lineorder`.`lo_custkey` = `customer`.`C_CUSTKEY` and 
`customer`.`c_region` = 'EUROPE' and 
`customer`.`c_nation` = 'UNITED KINGDOM' and 
`customer`.`c_city` in ('UNITED KI1', 'UNITED KI5') and 
`lineorder`.`lo_suppkey` = `supplier`.`S_SUPPKEY` and 
`supplier`.`s_region` = 'EUROPE' and 
`supplier`.`s_nation` = 'UNITED KINGDOM' and 
`supplier`.`s_city` in ('UNITED KI1', 'UNITED KI5') 

group by `dates`.`d_year`, `customer`.`c_region`, `customer`.`c_nation`, `customer`.`c_city`, `supplier`.`s_region`, `supplier`.`s_nation`, `supplier`.`s_city`;

3.2.23 ROLAP Q3.4 (10)

select `dates`.`d_year` as `c0`, 
`dates`.`d_yearmonth` as `c1`, 
`customer`.`c_region` as `c2`, 
`customer`.`c_nation` as `c3`, 
`customer`.`c_city` as `c4`, 
`supplier`.`s_region` as `c5`, 
`supplier`.`s_nation` as `c6`, 
`supplier`.`s_city` as `c7`, 
sum(`lineorder`.`lo_revenue`) as `m0` 

from `dates` as `dates`, `lineorder` as `lineorder`, `customer` as `customer`, `supplier` as `supplier` 

where `lineorder`.`lo_orderdate` = `dates`.`d_datekey` and 
`dates`.`d_year` = 1997 and 
`dates`.`d_yearmonth` = 'Dec1997' and 
`lineorder`.`lo_custkey` = `customer`.`C_CUSTKEY` and 
`customer`.`c_region` = 'EUROPE' and 
`customer`.`c_nation` = 'UNITED KINGDOM' and 
`customer`.`c_city` in ('UNITED KI1', 'UNITED KI5') and 
`lineorder`.`lo_suppkey` = `supplier`.`S_SUPPKEY` and 
`supplier`.`s_region` = 'EUROPE' and 
`supplier`.`s_nation` = 'UNITED KINGDOM' and 
`supplier`.`s_city` in ('UNITED KI1', 'UNITED KI5') 

group by `dates`.`d_year`, `dates`.`d_yearmonth`, `customer`.`c_region`, `customer`.`c_nation`, `customer`.`c_city`, `supplier`.`s_region`, `supplier`.`s_nation`, `supplier`.`s_city`;

3.2.24 ROLAP Q4.1 (11)

select `dates`.`d_year` as `c0`, 
`customer`.`c_region` as `c1`, 
`customer`.`c_nation` as `c2`, 
`part`.`p_mfgr` as `c3`, 
`supplier`.`s_region` as `c4`, 
sum(lo_revenue - lo_supplycost) as `m0` 

from `dates` as `dates`, `lineorder` as `lineorder`, `customer` as `customer`, `part` as `part`, `supplier` as `supplier` 

where `lineorder`.`lo_orderdate` = `dates`.`d_datekey` and 
`lineorder`.`lo_custkey` = `customer`.`C_CUSTKEY` and 
`customer`.`c_region` = 'AMERICA' and 
`customer`.`c_nation` in ('ARGENTINA', 'BRAZIL', 'CANADA', 'PERU', 'UNITED STATES') and 
`lineorder`.`lo_partkey` = `part`.`P_PARTKEY` and 
`part`.`p_mfgr` in ('MFGR#1', 'MFGR#2') and 
`lineorder`.`lo_suppkey` = `supplier`.`S_SUPPKEY` and 
`supplier`.`s_region` = 'AMERICA' 

group by `dates`.`d_year`, `customer`.`c_region`, `customer`.`c_nation`;

3.2.25 ROLAP Q4.2 (12)

select `dates`.`d_year` as `c0`, 
`customer`.`c_region` as `c1`, 
`part`.`p_mfgr` as `c2`, 
`part`.`p_category` as `c3`, 
`supplier`.`s_region` as `c4`, 
`supplier`.`s_nation` as `c5`, 
sum(lo_revenue - lo_supplycost) as `m0` 

from `dates` as `dates`, `lineorder` as `lineorder`, `customer` as `customer`, `part` as `part`, `supplier` as `supplier` 

where `lineorder`.`lo_orderdate` = `dates`.`d_datekey` and 
`dates`.`d_year` in (1997, 1998) and 
`lineorder`.`lo_custkey` = `customer`.`C_CUSTKEY` and 
`customer`.`c_region` = 'AMERICA' and 
`lineorder`.`lo_partkey` = `part`.`P_PARTKEY` and 
`part`.`p_mfgr` in ('MFGR#1', 'MFGR#2') and 
`part`.`p_category` in ('MFGR#11', 'MFGR#12', 'MFGR#13', 'MFGR#14', 'MFGR#15', 'MFGR#21', 'MFGR#22', 'MFGR#23', 'MFGR#24', 'MFGR#25') and 
`lineorder`.`lo_suppkey` = `supplier`.`S_SUPPKEY` and 
`supplier`.`s_region` = 'AMERICA' and 
`supplier`.`s_nation` in ('ARGENTINA', 'BRAZIL', 'CANADA', 'PERU', 'UNITED STATES') 

group by `dates`.`d_year`, `part`.`p_mfgr`, `part`.`p_category`, `supplier`.`s_region`, `supplier`.`s_nation`;

3.2.26 ROLAP Q4.3 (13)

select `dates`.`d_year` as `c0`, 
`part`.`p_mfgr` as `c1`, 
`part`.`p_category` as `c2`, 
`part`.`p_brand1` as `c3`, 
`supplier`.`s_region` as `c4`, 
`supplier`.`s_nation` as `c5`, 
`supplier`.`s_city` as `c6`, 
sum(lo_revenue - lo_supplycost) as `m0` 

from `dates` as `dates`, `lineorder` as `lineorder`, `customer` as `customer`, `part` as `part`, `supplier` as `supplier` 

where `lineorder`.`lo_orderdate` = `dates`.`d_datekey` and 
`dates`.`d_year` in (1997, 1998) and 
`lineorder`.`lo_custkey` = `customer`.`C_CUSTKEY` and 
`customer`.`c_region` = 'AMERICA' and 
`lineorder`.`lo_partkey` = `part`.`P_PARTKEY` and 
`part`.`p_mfgr` = 'MFGR#1' and 
`part`.`p_category` = 'MFGR#14' and 
`part`.`p_brand1` in ('MFGR#141', 'MFGR#1410', 'MFGR#1411', 'MFGR#1412', 'MFGR#1413', 'MFGR#1414', 'MFGR#1415', 'MFGR#1416', 'MFGR#1417', 'MFGR#1418', 'MFGR#1419', 'MFGR#142', 'MFGR#1420', 'MFGR#1421', 'MFGR#1422', 'MFGR#1423', 'MFGR#1424', 'MFGR#1425', 'MFGR#1426', 'MFGR#1427', 'MFGR#1428', 'MFGR#1429', 'MFGR#143', 'MFGR#1430', 'MFGR#1431', 'MFGR#1432', 'MFGR#1433', 'MFGR#1434', 'MFGR#1435', 'MFGR#1436', 'MFGR#1437', 'MFGR#1438', 'MFGR#1439', 'MFGR#144', 'MFGR#1440', 'MFGR#145', 'MFGR#146', 'MFGR#147', 'MFGR#148', 'MFGR#149') and 
`lineorder`.`lo_suppkey` = `supplier`.`S_SUPPKEY` and
`supplier`.`s_region` = 'AMERICA' and 
`supplier`.`s_nation` = 'UNITED STATES' and 
`supplier`.`s_city` in ('UNITED ST0', 'UNITED ST1', 'UNITED ST2', 'UNITED ST3', 'UNITED ST4', 'UNITED ST5', 'UNITED ST6', 'UNITED ST7', 'UNITED ST8', 'UNITED ST9') 

group by `dates`.`d_year`, `part`.`p_mfgr`, `part`.`p_category`, `part`.`p_brand1`, `supplier`.`s_region`, `supplier`.`s_nation`, `supplier`.`s_city`;

3.3 ROLAP-M

BIBM command:
java -classpath .:* com.openlinksw.bibm.tpch.TestDriver -uc ../ssb/mondrianSQL -q -defaultparams -mt 1 -scale 1 -dbdriver com.mysql.jdbc.Driver -sql jdbc:mysql://localhost/ssb1?user=root
Tools: Files: Preparation time: Rows/Triples: Results: For each SSB query, we now first list the SQL query that creates the data for the view, and then we list the SQL query that considers the view. Note, Mondrian requires a column "fact_count" in each aggregate table.

3.3.1 ROLAP-M Q1.1 (1)

Create query:
CREATE TABLE query1_aggtable (
    d_year INTEGER NOT NULL,
	lo_quantity double precision NOT NULL,
	lo_discount double precision NOT NULL,
    revenue BIGINT NOT NULL,
    fact_count INTEGER NOT NULL);
 
INSERT INTO query1_aggtable (
    d_year,
    lo_quantity,
    lo_discount,
    revenue,
    fact_count)
SELECT
    d_year,
    lo_quantity,
    lo_discount,
    sum(lo_extendedprice * lo_discount) as revenue,
    COUNT(*) AS fact_count
FROM
    lineorder, dates
WHERE 
    lineorder.lo_orderdate = dates.d_datekey
GROUP BY
    d_year,
	lo_quantity,
	lo_discount;
Read query:
select
	sum(revenue) as revenue
from 
    query1_aggtable
where 
    d_year = 1993
    and lo_quantity < 25
    and lo_discount between 1 and 3;

3.3.2 ROLAP-M Q1.2 (2)

Create query:
CREATE TABLE query2_aggtable (
    d_yearmonthnum INTEGER NOT NULL,
	lo_quantity double precision NOT NULL,
	lo_discount double precision NOT NULL,
    revenue BIGINT NOT NULL,
    fact_count INTEGER NOT NULL);
 
INSERT INTO query2_aggtable (
    d_yearmonthnum,
    lo_quantity,
    lo_discount,
    revenue,
    fact_count)
SELECT
    d_yearmonthnum,
    lo_quantity,
    lo_discount,
    sum(lo_extendedprice * lo_discount) as revenue,
    COUNT(*) AS fact_count
FROM
    lineorder, dates
WHERE 
    lineorder.lo_orderdate = dates.d_datekey
GROUP BY
    d_yearmonthnum,
	lo_quantity,
	lo_discount;
	
Read query:
select 
    sum(revenue) as revenue
from 
    query2_aggtable
where 
	d_yearmonthnum = 199401
    and lo_discount between 4 and 6
    and lo_quantity between 26 and 35;

3.3.3 ROLAP-M Q1.3 (3)

Create query:
CREATE TABLE query3_aggtable (
    d_weeknuminyear INTEGER NOT NULL,
    d_year INTEGER NOT NULL,
	lo_quantity double precision NOT NULL,
	lo_discount double precision NOT NULL,
    revenue BIGINT NOT NULL,
    fact_count INTEGER NOT NULL);
 
INSERT INTO query3_aggtable (
    d_weeknuminyear,
    d_year,
    lo_quantity,
    lo_discount,
    revenue,
    fact_count)
SELECT
    d_weeknuminyear,
    d_year,
    lo_quantity,
    lo_discount,
    sum(lo_extendedprice * lo_discount) as revenue,
    COUNT(*) AS fact_count
FROM
    lineorder, dates
WHERE 
    lineorder.lo_orderdate = dates.d_datekey
GROUP BY
    d_weeknuminyear,
    d_year,
	lo_quantity,
	lo_discount;
	
Read query:
select 
	sum(revenue) as revenue
from 
    query3_aggtable
where 
    d_weeknuminyear = 6
    and d_year = 1994
    and lo_discount between 5 and 7
    and lo_quantity between 26 and 35;

3.3.4 ROLAP-M Q2.1 (4)

Create query:
CREATE TABLE query4_aggtable (
    d_year INTEGER NOT NULL,
    p_mfgr char(6) NOT NULL,
    p_category char(7) NOT NULL,
    p_brand1 char(9) NOT NULL,
    s_region varchar(12) NOT NULL,
    lo_revenue int(11) NOT NULL,
    fact_count INTEGER NOT NULL);
 
INSERT INTO query4_aggtable (
    d_year,
    p_mfgr,
    p_category,
    p_brand1,
    s_region,
    lo_revenue,
    fact_count)
SELECT
    d_year,
    p_mfgr,
    p_category,
    p_brand1,
    s_region,
    SUM(lo_revenue) AS lo_revenue,
    COUNT(*) AS fact_count
FROM
    lineorder, dates, part, supplier
WHERE 
    lo_orderdate = d_datekey and
    lo_partkey = p_partkey and
    lo_suppkey = s_suppkey
GROUP BY
    d_year,
    p_mfgr,
    p_category,
    p_brand1,
    s_region;
Read query:
select 
    sum(lo_revenue) as lo_revenue, d_year, p_brand1
from 
    query4_aggtable
where 
	p_category = 'MFGR#12'
    and s_region = 'AMERICA'
group by 
    d_year, p_brand1
order by 
    d_year, p_brand1;

3.3.5 ROLAP-M Q2.2 (5)

Create query is the same as for Q2.1. Read query:
select 
    sum(lo_revenue) as lo_revenue, d_year, p_brand1
from 
    query4_aggtable
where 
	p_brand1 between 'MFGR#2221' and 'MFGR#2228'
    and s_region = 'ASIA'
group by 
    d_year, p_brand1
order by 
    d_year, p_brand1;

3.3.6 ROLAP-M Q2.3 (6)

Create query is the same as for Q2.1. Read query:
select 
    sum(lo_revenue) as lo_revenue, d_year, p_brand1
from 
    query4_aggtable
where 
	p_brand1 = 'MFGR#2239'
    and s_region = 'EUROPE'
group by 
    d_year, p_brand1
order by 
    d_year, p_brand1;

3.3.7 ROLAP-M Q3.1 (7)

Create query:
CREATE TABLE query7_aggtable (
    d_year INTEGER NOT NULL,
    c_nation varchar(15) NOT NULL,
    c_region varchar(12) NOT NULL,
    s_nation varchar(15) NOT NULL,
    s_region varchar(12) NOT NULL,
    lo_revenue BIGINT NOT NULL,
    fact_count INTEGER NOT NULL);
 
INSERT INTO query7_aggtable (
 	d_year,
 	c_nation,
 	c_region, 
 	s_nation, 
 	s_region,
    lo_revenue,
    fact_count)
SELECT
	d_year,
	c_nation, 
	c_region,
 	s_nation,
 	s_region, 
    sum(lo_revenue) as lo_revenue,
    COUNT(*) AS fact_count
FROM
    customer, lineorder, supplier, dates
WHERE 
	lo_custkey = c_custkey
    and lo_suppkey = s_suppkey
    and lo_orderdate = d_datekey
GROUP BY
	d_year,
	c_nation, 
	s_nation;
Read query:
select 
    c_nation, s_nation, d_year,
    sum(lo_revenue) as lo_revenue
from 
    query7_aggtable
where 
	c_region = 'ASIA'
    and s_region = 'ASIA'
    and d_year >= 1992 and d_year <= 1997
group by 
    c_nation, s_nation, d_year
order by 
    d_year asc, lo_revenue desc;

3.3.8 ROLAP-M Q3.2 (8)

Create query:
CREATE TABLE query8_aggtable (
    d_year INTEGER NOT NULL,
    c_city varchar(10) NOT NULL,
    c_nation varchar(15) NOT NULL,
    s_city varchar(10) NOT NULL,
    s_nation varchar(15) NOT NULL,
    lo_revenue BIGINT NOT NULL,
    fact_count INTEGER NOT NULL);
 
INSERT INTO query8_aggtable (
 	d_year,
	c_city, 
 	c_nation,
 	s_city,  
 	s_nation, 
    lo_revenue,
    fact_count)
SELECT
	d_year,
	c_city, 
	c_nation,
	s_city, 
	s_nation,
    sum(lo_revenue) as lo_revenue,
    COUNT(*) AS fact_count
FROM
    customer, lineorder, supplier, dates
WHERE 
	lo_custkey = c_custkey
    and lo_suppkey = s_suppkey
    and lo_orderdate = d_datekey
    and d_year = 1992
GROUP BY
	c_city, s_city, d_year;
	
Read query:
select 
    c_city, s_city, d_year, sum(lo_revenue) as lo_revenue
from 
    query8_aggtable
where 
	c_nation = 'UNITED STATES'
    and s_nation = 'UNITED STATES'
    and d_year >= 1992 and d_year <= 1997
group by 
    c_city, s_city, d_year
order by 
    d_year asc, lo_revenue desc;

3.3.9 ROLAP-M Q3.3 (9)

Create query is the same as for Q3.2. Read query:
select 
    c_city, s_city, d_year, sum(lo_revenue) as lo_revenue
from 
    query8_aggtable
where 
	(c_city='UNITED KI1' or c_city='UNITED KI5')
    and (s_city='UNITED KI1' or s_city='UNITED KI5')
    and d_year >= 1992 and d_year <= 1997
group by 
    c_city, s_city, d_year
order by 
    d_year asc, lo_revenue desc;

3.3.10 ROLAP-M Q3.4 (10)

Create query:
CREATE TABLE query10_aggtable (
    d_yearmonth varchar(7) NOT NULL,
    d_year INTEGER NOT NULL,
    c_city varchar(10) NOT NULL,
    s_city varchar(10) NOT NULL,
    lo_revenue BIGINT NOT NULL,
    fact_count INTEGER NOT NULL);
 
INSERT INTO query10_aggtable (
 	d_yearmonth,
 	d_year,
	c_city, 
 	s_city,   
    lo_revenue,
    fact_count)
SELECT
	d_yearmonth,
	d_year,
	c_city, 
	s_city, 
    sum(lo_revenue) as lo_revenue,
    COUNT(*) AS fact_count
FROM
    customer, lineorder, supplier, dates
WHERE 
	lo_custkey = c_custkey
    and lo_suppkey = s_suppkey
    and lo_orderdate = d_datekey
GROUP BY
	c_city, s_city, d_yearmonth;
	
Read query:
select 
    c_city, s_city, d_year, sum(lo_revenue) as lo_revenue
from 
    query10_aggtable
where 
	(c_city='UNITED KI1' or c_city='UNITED KI5')
    and (s_city='UNITED KI1' or s_city='UNITED KI5')
    and d_yearmonth = 'Dec1997'
group by 
    c_city, s_city, d_year
order by 
    d_year asc, lo_revenue desc;

3.3.11 ROLAP-M Q4.1 (11)

Create query:
DROP TABLE query11_aggtable;

CREATE TABLE query11_aggtable (
	d_year INTEGER NOT NULL,
    c_nation varchar(15) NOT NULL,
    c_region varchar(12) NOT NULL,
    s_region varchar(12) NOT NULL,
    p_mfgr varchar(6) NOT NULL,
    profit BIGINT NOT NULL,
    fact_count INTEGER NOT NULL);
 
INSERT INTO query11_aggtable (
	d_year, 
	s_region,
	c_nation,
	c_region, 
	p_mfgr,  
    profit,
    fact_count)
SELECT
	d_year, 
	s_region,
	c_nation,
	c_region, 
	p_mfgr, 
    sum(lo_revenue - lo_supplycost) as profit,
    COUNT(*) AS fact_count
FROM
    dates, customer, supplier, part, lineorder
WHERE 
    lo_custkey = c_custkey
    and lo_suppkey = s_suppkey
    and lo_partkey = p_partkey
    and lo_orderdate = d_datekey
GROUP BY
	d_year, c_nation, s_region, p_mfgr;
Read query:
select 
    d_year, c_nation,
    sum(profit) as profit
from 
    query11_aggtable
where 
	c_region = 'AMERICA'
    and s_region = 'AMERICA'
    and (p_mfgr = 'MFGR#1' or p_mfgr = 'MFGR#2')
group by 
    d_year, c_nation
order by 
    d_year, c_nation;

3.3.12 ROLAP-M Q4.2 (12)

Create query:
DROP TABLE query12_aggtable;

CREATE TABLE query12_aggtable (
	d_year INTEGER NOT NULL,
    c_region varchar(12) NOT NULL,
    s_nation varchar(15) NOT NULL,
    s_region varchar(12) NOT NULL,
    p_category varchar(7) NOT NULL,
    p_mfgr varchar(6) NOT NULL,
    profit BIGINT NOT NULL,
    fact_count INTEGER NOT NULL);
 
INSERT INTO query12_aggtable (
	d_year, 
	s_region,
	s_nation,
	c_region,
	p_category, 
	p_mfgr,  
    profit,
    fact_count)
SELECT
	d_year, 
	s_region,
	s_nation,
	c_region,
	p_category, 
	p_mfgr,  
    sum(lo_revenue - lo_supplycost) as profit,
    COUNT(*) AS fact_count
FROM
    dates, customer, supplier, part, lineorder
WHERE 
    lo_custkey = c_custkey
    and lo_suppkey = s_suppkey
    and lo_partkey = p_partkey
    and lo_orderdate = d_datekey
GROUP BY
	d_year, s_nation, c_region,	p_category, p_mfgr;
	
Read query:
select 
    d_year, s_nation, p_category,
    sum(profit) as profit
from 
    query12_aggtable
where 
    c_region = 'AMERICA'
    and s_region = 'AMERICA'
    and (d_year = 1997 or d_year = 1998)
    and (p_mfgr = 'MFGR#1' or p_mfgr = 'MFGR#2')
group by 
    d_year, s_nation, p_category
order by 
    d_year, s_nation, p_category;

3.3.13 ROLAP-M Q4.3 (13)

Create query:
DROP TABLE query13_aggtable;

CREATE TABLE query13_aggtable (
	d_year INTEGER NOT NULL,
    c_region varchar(12) NOT NULL,
    s_city varchar(10) NOT NULL,
    s_nation varchar(15) NOT NULL,
    p_brand1 varchar(9) NOT NULL,
    p_category varchar(7) NOT NULL,
    profit BIGINT NOT NULL,
    fact_count INTEGER NOT NULL);
 
INSERT INTO query13_aggtable (
	d_year, 
	s_city,
	s_nation,
	c_region,
	p_brand1, 
	p_category,  
    profit,
    fact_count)
SELECT
	d_year, 
	s_city,
	s_nation,
	c_region,
	p_brand1, 
	p_category,
    sum(lo_revenue - lo_supplycost) as profit,
    COUNT(*) AS fact_count
FROM
    dates, customer, supplier, part, lineorder
WHERE 
    lo_custkey = c_custkey
    and lo_suppkey = s_suppkey
    and lo_partkey = p_partkey
    and lo_orderdate = d_datekey
    and d_year = 1992
GROUP BY
	d_year, s_city, s_nation, c_region, p_brand1, p_category;
	
Read query:
select 
    d_year, s_city, p_brand1,
    sum(profit) as profit
from 
    query13_aggtable
where 
	c_region = 'AMERICA'
    and s_nation = 'UNITED STATES'
    and (d_year = 1997 or d_year = 1998)
    and p_category = 'MFGR#14'
group by 
    d_year, s_city, p_brand1
order by 
    d_year, s_city, p_brand1;

3.4 OLAP4LD-SSB

BIBM command:
java -classpath .:* com.openlinksw.bibm.tpch.TestDriver -uc ../ssb/openvirtuoso/ -q -defaultparams -mt 1 -scale 1 http://localhost:8890/sparql
Tools: Open Virtuoso Setting: we disable ResultSetMaxRows; set the NumberOfBuffers (42500) and MaxDirtyBuffers (32500) so that OpenVirtuoso would not be able to store the entire SSB data into memory. Also, we set MaxQueryCostEstimationTime and MaxQueryExecutionTime high enough for complex analytical queries. Files: Preparation time: Rows/Triples: Results: We now list all queries:

3.4.1 OLAP4LD-SSB Q1.1 (1)

prefix rdfh: <http://lod2.eu/schemas/rdfh#>

select
  sum(?lo_extendedprice * ?lo_discount) as ?sum_revenue
from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb> 

where {
    ?li a rdfh:lineorder ;
       rdfh:lo_orderdate ?lo_orderdate ;
       rdfh:lo_extendedprice ?lo_extendedprice ;
       rdfh:lo_discount ?lo_discount ;
       rdfh:lo_quantity ?lo_quantity .

    ?lo_orderdate rdfh:d_year ?d_year .
       
    filter ( (?d_year = 1993) &&
      (?lo_discount >= 1) &&
      (?lo_discount <= 3) &&
      (?lo_quantity < 25) ) 
}

3.4.2 OLAP4LD-SSB Q1.2 (2)

prefix rdfh: <http://lod2.eu/schemas/rdfh#>

select
  sum(?lo_extendedprice * ?lo_discount) as ?sum_revenue
from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>

where {
    ?li a rdfh:lineorder ;
       rdfh:lo_orderdate ?lo_orderdate ;
       rdfh:lo_extendedprice ?lo_extendedprice ;
       rdfh:lo_discount ?lo_discount ;
       rdfh:lo_quantity ?lo_quantity .

    ?lo_orderdate rdfh:d_yearmonthnum ?d_yearmonthnum .
       
    filter ( (?d_yearmonthnum = 199401) &&
      (?lo_discount >= 4) &&
      (?lo_discount <= 6) &&
      (?lo_quantity >= 26) &&
      (?lo_quantity <= 35) ) 
}
    

3.4.3 OLAP4LD-SSB Q1.3 (3)

prefix rdfh: <http://lod2.eu/schemas/rdfh#>

select
  sum(?lo_extendedprice * ?lo_discount) as ?sum_revenue
from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>
where {
    ?li a rdfh:lineorder ;
       rdfh:lo_orderdate ?lo_orderdate ;
       rdfh:lo_extendedprice ?lo_extendedprice ;
       rdfh:lo_discount ?lo_discount ;
       rdfh:lo_quantity ?lo_quantity .

    ?lo_orderdate rdfh:d_weeknuminyear ?d_weeknuminyear .
    ?lo_orderdate rdfh:d_year ?d_year .
       
    filter ( (?d_weeknuminyear = 6) &&
      (?d_year = 1994) &&
      (?lo_discount >= 5) &&
      (?lo_discount <= 7) &&
      (?lo_quantity >= 26) &&
      (?lo_quantity <= 35) ) 
}
    
 

3.4.4 OLAP4LD-SSB Q2.1 (4)

prefix rdfh: <http://lod2.eu/schemas/rdfh#>

select
  sum(?rdfh_lo_revenue) as ?lo_revenue ?d_year ?p_brand1 
from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>

where {
    ?li a rdfh:lineorder ;
       rdfh:lo_orderdate ?lo_orderdate ;
       rdfh:lo_partkey ?lo_partkey ;
       rdfh:lo_suppkey ?lo_suppkey ;
	   rdfh:lo_revenue ?rdfh_lo_revenue .

    ?lo_orderdate rdfh:d_year ?d_year .
    ?lo_partkey rdfh:p_brand1 ?p_brand1 .
    ?lo_partkey rdfh:p_category "MFGR#12" .
    ?lo_suppkey rdfh:s_region "AMERICA" . 
} group by ?d_year ?p_brand1 order by ?d_year ?p_brand1

3.4.5 OLAP4LD-SSB Q2.2 (5)

prefix rdfh: <http://lod2.eu/schemas/rdfh#>

select
  sum(?rdfh_lo_revenue) as ?lo_revenue ?d_year ?p_brand1 
from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>

where {
    ?li a rdfh:lineorder ;
       rdfh:lo_orderdate ?lo_orderdate ;
       rdfh:lo_partkey ?lo_partkey ;
       rdfh:lo_suppkey ?lo_suppkey ;
	   rdfh:lo_revenue ?rdfh_lo_revenue .

    ?lo_orderdate rdfh:d_year ?d_year .
    ?lo_partkey rdfh:p_brand1 ?p_brand1 .
    ?lo_suppkey rdfh:s_region "ASIA" . 
    
    FILTER ( str(?p_brand1) >= "MFGR#2221" and str(?p_brand1) <= "MFGR#2228")
} group by ?d_year ?p_brand1 order by ?d_year ?p_brand1

3.4.6 OLAP4LD-SSB Q2.3 (6)

prefix rdfh: <http://lod2.eu/schemas/rdfh#>

select
  sum(?rdfh_lo_revenue) as ?lo_revenue ?d_year ?p_brand1 
from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>

where {
    ?li a rdfh:lineorder ;
       rdfh:lo_orderdate ?lo_orderdate ;
       rdfh:lo_partkey ?lo_partkey ;
       rdfh:lo_suppkey ?lo_suppkey ;
	   rdfh:lo_revenue ?rdfh_lo_revenue .

    ?lo_orderdate rdfh:d_year ?d_year .
    ?lo_partkey rdfh:p_brand1 ?p_brand1 .
    ?lo_suppkey rdfh:s_region "EUROPE" . 
    
    FILTER ( str(?p_brand1) = "MFGR#2239")
} group by ?d_year ?p_brand1 order by ?d_year ?p_brand1

3.4.7 OLAP4LD-SSB Q3.1 (7)

prefix rdfh: <http://lod2.eu/schemas/rdfh#>

select
  ?c_nation ?s_nation ?d_year sum(?rdfh_lo_revenue) as ?lo_revenue 
from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>

where {
    ?li a rdfh:lineorder ;
       rdfh:lo_orderdate ?lo_orderdate ;
       rdfh:lo_custkey ?lo_custkey ;
       rdfh:lo_suppkey ?lo_suppkey ;
	   rdfh:lo_revenue ?rdfh_lo_revenue .

    ?lo_orderdate rdfh:d_year ?d_year .
    ?lo_custkey rdfh:c_nation ?c_nation .
    ?lo_custkey rdfh:c_region "ASIA" .
    ?lo_suppkey rdfh:s_nation ?s_nation .
    ?lo_suppkey rdfh:s_region "ASIA" . 
    
    FILTER ( ?d_year >= 1992 and ?d_year <= 1997)
} group by ?c_nation ?s_nation ?d_year order by asc(?d_year) desc(?lo_revenue)

3.4.8 OLAP4LD-SSB Q3.2 (8)

prefix rdfh: <http://lod2.eu/schemas/rdfh#>

select
  ?c_city ?s_city ?d_year sum(?rdfh_lo_revenue) as ?lo_revenue 
from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>

where {
    ?li a rdfh:lineorder ;
       rdfh:lo_orderdate ?lo_orderdate ;
       rdfh:lo_custkey ?lo_custkey ;
       rdfh:lo_suppkey ?lo_suppkey ;
	   rdfh:lo_revenue ?rdfh_lo_revenue .

    ?lo_orderdate rdfh:d_year ?d_year .
    ?lo_custkey rdfh:c_nation "UNITED STATES" .
    ?lo_custkey rdfh:c_city ?c_city .
    ?lo_suppkey rdfh:s_nation "UNITED STATES" .
    ?lo_suppkey rdfh:s_city ?s_city . 
    
    FILTER ( ?d_year >= 1992 and ?d_year <= 1997)
} group by ?c_city ?s_city ?d_year order by asc(?d_year) desc(?lo_revenue)

3.4.9 OLAP4LD-SSB Q3.3 (9)

prefix rdfh: <http://lod2.eu/schemas/rdfh#>

select
  ?c_city ?s_city ?d_year sum(?rdfh_lo_revenue) as ?lo_revenue 
from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>

where {
    ?li a rdfh:lineorder ;
       rdfh:lo_orderdate ?lo_orderdate ;
       rdfh:lo_custkey ?lo_custkey ;
       rdfh:lo_suppkey ?lo_suppkey ;
	   rdfh:lo_revenue ?rdfh_lo_revenue .

    ?lo_orderdate rdfh:d_year ?d_year .
    ?lo_custkey rdfh:c_city ?c_city .
    ?lo_suppkey rdfh:s_city ?s_city . 
    
    FILTER ( ?d_year >= 1992 and ?d_year <= 1997 and (?c_city='UNITED KI1' or ?c_city='UNITED KI5') and (?s_city='UNITED KI1' or ?s_city='UNITED KI5'))
} group by ?c_city ?s_city ?d_year order by asc(?d_year) desc(?lo_revenue)

3.4.10 OLAP4LD-SSB Q3.4 (10)

prefix rdfh: <http://lod2.eu/schemas/rdfh#>

select
  ?c_city ?s_city ?d_year sum(?rdfh_lo_revenue) as ?lo_revenue 
from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>

where {
    ?li a rdfh:lineorder ;
       rdfh:lo_orderdate ?lo_orderdate ;
       rdfh:lo_custkey ?lo_custkey ;
       rdfh:lo_suppkey ?lo_suppkey ;
	   rdfh:lo_revenue ?rdfh_lo_revenue .

    ?lo_orderdate rdfh:d_year ?d_year .
    ?lo_orderdate rdfh:d_yearmonth ?d_yearmonth .
    ?lo_custkey rdfh:c_city ?c_city .
    ?lo_suppkey rdfh:s_city ?s_city . 
    
    FILTER ( ?d_yearmonth = "Dec1997" and (?c_city='UNITED KI1' or ?c_city='UNITED KI5') and (?s_city='UNITED KI1' or ?s_city='UNITED KI5'))
} group by ?c_city ?s_city ?d_year order by asc(?d_year) desc(?lo_revenue)

3.4.11 OLAP4LD-SSB Q4.1 (11)

prefix rdfh: <http://lod2.eu/schemas/rdfh#>

select
  ?d_year ?c_nation sum(?lo_revenue - ?lo_supplycost) as ?sum_profit 
from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>

where {
    ?li a rdfh:lineorder ;
       rdfh:lo_orderdate ?lo_orderdate ;
       rdfh:lo_custkey ?lo_custkey ;
       rdfh:lo_suppkey ?lo_suppkey ;
	   rdfh:lo_revenue ?lo_revenue ;
	   rdfh:lo_supplycost ?lo_supplycost .

    ?lo_orderdate rdfh:d_year ?d_year .
    ?lo_custkey rdfh:c_region "AMERICA" .
    ?lo_suppkey rdfh:s_region "AMERICA" .
    ?lo_custkey rdfh:c_nation ?c_nation .
    ?lo_partkey rdfh:p_mfgr ?p_mfgr . 
    
    FILTER (?d_year = 1992 and (?p_mfgr = 'MFGR#1' or ?p_mfgr = 'MFGR#2')).
} group by ?d_year ?c_nation order by ?d_year ?c_nation

3.4.12 OLAP4LD-SSB Q4.2 (12)

prefix rdfh: <http://lod2.eu/schemas/rdfh#>

select
  ?d_year ?s_nation ?p_category sum(?lo_revenue - ?lo_supplycost) as ?sum_profit 
from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>

where {
    ?li a rdfh:lineorder ;
       rdfh:lo_orderdate ?lo_orderdate ;
       rdfh:lo_custkey ?lo_custkey ;
       rdfh:lo_partkey ?lo_partkey ;
       rdfh:lo_suppkey ?lo_suppkey ;
	   rdfh:lo_revenue ?lo_revenue ;
	   rdfh:lo_supplycost ?lo_supplycost .

    ?lo_orderdate rdfh:d_year ?d_year .
    ?lo_custkey rdfh:c_region "AMERICA" .
    ?lo_suppkey rdfh:s_region "AMERICA" .
    ?lo_suppkey rdfh:s_nation ?s_nation .
    ?lo_partkey rdfh:p_mfgr ?p_mfgr .
    ?lo_partkey rdfh:p_category ?p_category .  
    
    FILTER ( (?d_year = 1997 or ?d_year = 1998) and  (?p_mfgr = 'MFGR#1' or ?p_mfgr = 'MFGR#2') )
} group by ?d_year ?s_nation ?p_category order by ?d_year ?s_nation ?p_category

3.4.13 OLAP4LD-SSB Q4.3 (13)

prefix rdfh: <http://lod2.eu/schemas/rdfh#>

select
  ?d_year ?s_city ?p_brand1 sum(?lo_revenue - ?lo_supplycost) as ?sum_profit 
from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>

where {
    ?li a rdfh:lineorder ;
       rdfh:lo_orderdate ?lo_orderdate ;
       rdfh:lo_custkey ?lo_custkey ;
       rdfh:lo_partkey ?lo_partkey ;
       rdfh:lo_suppkey ?lo_suppkey ;
	   rdfh:lo_revenue ?lo_revenue ;
	   rdfh:lo_supplycost ?lo_supplycost .

    ?lo_orderdate rdfh:d_year ?d_year .
	?lo_custkey rdfh:c_region "AMERICA" .
    ?lo_suppkey rdfh:s_city ?s_city .
    ?lo_suppkey rdfh:s_nation "UNITED STATES" .
    ?lo_partkey rdfh:p_category "MFGR#14" .  
    ?lo_partkey rdfh:p_brand1 ?p_brand1 .
    
    FILTER ( (?d_year = 1997 or ?d_year = 1998) )
} group by ?d_year ?s_city ?p_brand1 order by ?d_year ?s_city ?p_brand1

3.5 OLAP4LD-QB

BIBM command:
java -classpath .:* com.openlinksw.bibm.tpch.TestDriver -uc ../ssb/olap4ldSPARQL/ -q -defaultparams -mt 1 -scale 1 http://aifb-ls3-remus.aifb.kit.edu:8890/sparql
Tools: Sed command line program for modifying the OLAP4LD-SSB RDF to reuse QB (adding links):
sed 's/a rdfh:lineorder ;/a rdfh:lineorder ; a <http:\/\/purl.org\/linked-data\/cube#Observation>; <http:\/\/purl.org\/linked-data\/cube#dataSet> <http:\/\/lod2.eu\/schemas\/rdfh-inst#ds>;/g' lineorder.ttl > lineorder_qb.ttl
Files: Preparation time: Rows/Triples: Results: We first list the SPARQL INSERT queries for creating the levels:

3.5.1 Dates Levels SPARQL INSERT

prefix rdfh: <http://lod2.eu/schemas/rdfh#> 
prefix rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#>
prefix qb: <http://purl.org/linked-data/cube#> 
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
prefix skos: <http://www.w3.org/2004/02/skos/core#> 
prefix skosclass: <http://ddialliance.org/ontologies/skosclass#> 

INSERT INTO GRAPH <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> { 

rdfh:lo_orderdateWeeknuminyearLevel skos:member `iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_orderdateWeeknuminyear", bif:concat (str(?d_year), str(?d_weeknuminyear))))`. 
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_orderdateWeeknuminyear", bif:concat (str(?d_year), str(?d_weeknuminyear))))` skos:inScheme rdfh:lo_orderdateWeeknuminyearCodeList. 
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_orderdateWeeknuminyear", bif:concat (str(?d_year), str(?d_weeknuminyear))))` skos:narrower ?date.

rdfh:lo_orderdateWeeknuminyearDateLevel skos:member ?date.
?date skos:inScheme rdfh:lo_orderdateWeeknuminyearCodeList.

rdfh:lo_orderdateYearLevel skos:member `iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_orderdateYear", str(?d_year)))`. 
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_orderdateYear", str(?d_year)))` skos:inScheme rdfh:lo_orderdateCodeList. 
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_orderdateYear", str(?d_year)))` skos:narrower `iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_orderdateYearMonth", str(?d_yearmonth)))` .

rdfh:lo_orderdateYearMonthLevel skos:member `iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_orderdateYearMonth", str(?d_yearmonth)))` .
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_orderdateYearMonth", str(?d_yearmonth)))` skos:inScheme rdfh:lo_orderdateCodeList. 
 `iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_orderdateYearMonth", str(?d_yearmonth)))` skos:narrower `iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_orderdateYearMonthNum", str(?d_yearmonthnum)))` .

rdfh:lo_orderdateYearMonthNumLevel skos:member `iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_orderdateYearMonthNum", str(?d_yearmonthnum)))` .
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_orderdateYearMonthNum", str(?d_yearmonthnum)))` skos:inScheme rdfh:lo_orderdateCodeList. 
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_orderdateYearMonthNum", str(?d_yearmonthnum)))` skos:narrower ?date .

rdfh:lo_orderdateDateLevel skos:member ?date.
?date skos:inScheme rdfh:lo_orderdateCodeList.

}
from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>
WHERE
 {
      ?date a rdfh:date.
	  ?date rdfh:d_weeknuminyear ?d_weeknuminyear.
      ?date rdfh:d_year ?d_year.
      ?date rdfh:d_yearmonth ?d_yearmonth.
      ?date rdfh:d_yearmonthnum ?d_yearmonthnum.
 }
 

3.5.2 Customer Levels SPARQL INSERT

prefix rdfh: <http://lod2.eu/schemas/rdfh#> 
prefix rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#>
prefix qb: <http://purl.org/linked-data/cube#> 
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
prefix skos: <http://www.w3.org/2004/02/skos/core#> 
prefix skosclass: <http://ddialliance.org/ontologies/skosclass#> 

INSERT INTO GRAPH <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> { 

rdfh:lo_custkeyRegionLevel skos:member `iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_custkeyRegion", bif:replace(str(?c_region), " ", "-")))`.
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_custkeyRegion", bif:replace(str(?c_region), " ", "-")))` skos:inScheme rdfh:lo_custkeyCodeList.
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_custkeyRegion", bif:replace(str(?c_region), " ", "-")))` skos:narrower `iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_custkeyNation", bif:replace(str(?c_nation), " ", "-")))`.

rdfh:lo_custkeyNationLevel skos:member `iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_custkeyNation", bif:replace(str(?c_nation), " ", "-")))`.
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_custkeyNation", bif:replace(str(?c_nation), " ", "-")))` skos:inScheme rdfh:lo_custkeyCodeList.
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_custkeyNation", bif:replace(str(?c_nation), " ", "-")))` skos:narrower `iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_custkeyCity", bif:replace(str(?c_city), " ", "-")))`.

rdfh:lo_custkeyCityLevel skos:member `iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_custkeyCity", bif:replace(str(?c_city), " ", "-")))`.
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_custkeyCity", bif:replace(str(?c_city), " ", "-")))` skos:inScheme rdfh:lo_custkeyCodeList.
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_custkeyCity", bif:replace(str(?c_city), " ", "-")))` skos:narrower ?supp.

rdfh:lo_custkeyCustomerLevel skos:member ?supp.
?supp skos:inScheme rdfh:lo_custkeyCodeList.

}
from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb> from <http://lod2.eu/schemas/rdfh-inst#dimensionsssbS1>
WHERE
 {
      ?supp a rdfh:customer.
      ?supp rdfh:c_region ?c_region.
      ?supp rdfh:c_nation ?c_nation.
      ?supp rdfh:c_city ?c_city.
 }
 

3.5.3 Part Levels SPARQL INSERT

prefix rdfh: <http://lod2.eu/schemas/rdfh#> 
prefix rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#>
prefix qb: <http://purl.org/linked-data/cube#> 
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
prefix skos: <http://www.w3.org/2004/02/skos/core#> 
prefix skosclass: <http://ddialliance.org/ontologies/skosclass#> 

INSERT INTO GRAPH <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> { 

rdfh:lo_partkeyMfgrLevel skos:member `iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_partkeyMfgr", bif:replace(str(?p_mfgr),"#","-")))`.
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_partkeyMfgr", bif:replace(str(?p_mfgr),"#","-")))` skos:inScheme  rdfh:lo_partkeyCodeList.
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_partkeyMfgr", bif:replace(str(?p_mfgr),"#","-")))` skos:narrower `iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_partkeyCategory", bif:replace(str(?p_category),"#","-")))`.

rdfh:lo_partkeyCategoryLevel skos:member `iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_partkeyCategory", bif:replace(str(?p_category),"#","-")))`.
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_partkeyCategory", bif:replace(str(?p_category),"#","-")))` skos:inScheme  rdfh:lo_partkeyCodeList.
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_partkeyCategory", bif:replace(str(?p_category), "#", "-")))` skos:narrower `iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_partkeyBrand1", bif:replace(str(?p_brand1),"#","-")))`.

rdfh:lo_partkeyBrand1Level skos:member `iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_partkeyBrand1", bif:replace(str(?p_brand1),"#","-")))`.
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_partkeyBrand1", bif:replace(str(?p_brand1),"#","-")))` skos:inScheme  rdfh:lo_partkeyCodeList.
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_partkeyBrand1", bif:replace(str(?p_brand1),"#","-")))` skos:narrower ?part.

rdfh:lo_partkeyPartLevel skos:member ?part.
?part skos:inScheme rdfh:lo_partkeyCodeList.

}
from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>
WHERE
 {
      ?part a rdfh:part.
      ?part rdfh:p_mfgr ?p_mfgr.
      ?part rdfh:p_category ?p_category.
      ?part rdfh:p_brand1 ?p_brand1.
 }

3.5.4 Supplier Levels SPARQL INSERT

prefix rdfh: <http://lod2.eu/schemas/rdfh#> 
prefix rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#>
prefix qb: <http://purl.org/linked-data/cube#> 
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
prefix skos: <http://www.w3.org/2004/02/skos/core#> 
prefix skosclass: <http://ddialliance.org/ontologies/skosclass#> 

INSERT INTO GRAPH <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> { 

rdfh:lo_suppkeyRegionLevel skos:member `iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_suppkeyRegion", bif:replace(str(?s_region), " ", "-")))`.
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_suppkeyRegion", bif:replace(str(?s_region), " ", "-")))` skos:inScheme rdfh:lo_suppkeyCodeList. 
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_suppkeyRegion", bif:replace(str(?s_region), " ", "-")))` skos:narrower `iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_suppkeyNation", bif:replace(str(?s_nation), " ", "-")))`.

rdfh:lo_suppkeyNationLevel skos:member `iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_suppkeyNation", bif:replace(str(?s_nation), " ", "-")))`.
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_suppkeyNation", bif:replace(str(?s_nation), " ", "-")))` skos:inScheme rdfh:lo_suppkeyCodeList. 
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_suppkeyNation", bif:replace(str(?s_nation), " ", "-")))` skos:narrower `iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_suppkeyCity", bif:replace(str(?s_city), " ", "-")))`.

rdfh:lo_suppkeyCityLevel skos:member `iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_suppkeyCity", bif:replace(str(?s_city), " ", "-")))`.
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_suppkeyCity", bif:replace(str(?s_city), " ", "-")))` skos:inScheme rdfh:lo_suppkeyCodeList. 
`iri (bif:concat ("http://lod2.eu/schemas/rdfh#lo_suppkeyCity", bif:replace(str(?s_city), " ", "-")))` skos:narrower ?supp.

rdfh:lo_suppkeySupplierLevel skos:member ?supp.
?supp skos:inScheme rdfh:lo_suppkeyCodeList.
 
}
from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>
WHERE
 {
      ?supp a rdfh:supplier.
      ?supp rdfh:s_region ?s_region.
      ?supp rdfh:s_nation ?s_nation.
      ?supp rdfh:s_city ?s_city.
 }
 
We now list all queries:

3.5.5 OLAP4LD-QB Q1.1 (1)

PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select  SUM(?rdfh_lo_extendedprice * ?rdfh_lo_discount) as ?sum_revenue

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels>

where {  

?obs qb:dataSet rdfh-inst:ds. 

?obs <http://lod2.eu/schemas/rdfh#lo_orderdate>  ?rdfh_lo_orderdate0.
?rdfh_lo_orderdate1 skos:narrower ?rdfh_lo_orderdate0.
?rdfh_lo_orderdate2 skos:narrower ?rdfh_lo_orderdate1.
?rdfh_lo_orderdate skos:narrower ?rdfh_lo_orderdate2.
<http://lod2.eu/schemas/rdfh#lo_orderdateYearLevel> skos:member ?rdfh_lo_orderdate . 

?obs <http://lod2.eu/schemas/rdfh#lo_extendedprice> ?rdfh_lo_extendedprice. 
?obs <http://lod2.eu/schemas/rdfh#lo_discount> ?rdfh_lo_discount. 
?obs <http://lod2.eu/schemas/rdfh#lo_quantity> ?rdfh_lo_quantity 

FILTER(?rdfh_lo_quantity <= 24). 
FILTER(?rdfh_lo_discount >= 1 AND ?rdfh_lo_discount <= 3). 
FILTER(?rdfh_lo_orderdate = <http://lod2.eu/schemas/rdfh#lo_orderdateYear1993> ).

} 

3.5.6 OLAP4LD-QB Q1.2 (2)

PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select SUM(?rdfh_lo_extendedprice * ?rdfh_lo_discount) as ?sum_revenue

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 

where {  

?obs qb:dataSet rdfh-inst:ds. 
 
?obs <http://lod2.eu/schemas/rdfh#lo_orderdate>  ?rdfh_lo_orderdate0. 
?rdfh_lo_orderdate skos:narrower ?rdfh_lo_orderdate0. 
<http://lod2.eu/schemas/rdfh#lo_orderdateYearMonthNumLevel> skos:member ?rdfh_lo_orderdate. 
?obs <http://lod2.eu/schemas/rdfh#lo_extendedprice> ?rdfh_lo_extendedprice. 
?obs <http://lod2.eu/schemas/rdfh#lo_discount> ?rdfh_lo_discount. 
?obs <http://lod2.eu/schemas/rdfh#lo_quantity> ?rdfh_lo_quantity 
FILTER(?rdfh_lo_quantity >= 26 AND ?rdfh_lo_quantity <= 35). 
FILTER(?rdfh_lo_discount >= 4 AND ?rdfh_lo_discount <= 6). 
FILTER(?rdfh_lo_orderdate = <http://lod2.eu/schemas/rdfh#lo_orderdateYearMonthNum199401> ).

}  
    

3.5.7 OLAP4LD-QB Q1.3 (3)

PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select SUM(?rdfh_lo_extendedprice * ?rdfh_lo_discount) as ?sum_revenue

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 

where {  

?obs qb:dataSet rdfh-inst:ds.  
?obs rdfh:lo_orderdate  ?rdfh_lo_orderdate0. 
?rdfh_lo_orderdate skos:narrower ?rdfh_lo_orderdate0. 
rdfh:lo_orderdateWeeknuminyearLevel skos:member ?rdfh_lo_orderdate. 
?obs rdfh:lo_extendedprice ?rdfh_lo_extendedprice. 
?obs rdfh:lo_discount ?rdfh_lo_discount. 
?obs rdfh:lo_quantity ?rdfh_lo_quantity 
FILTER(?rdfh_lo_quantity >= 26 AND ?rdfh_lo_quantity <= 35). 
FILTER(?rdfh_lo_discount >= 5 AND ?rdfh_lo_discount <= 7). 
FILTER(?rdfh_lo_orderdate = rdfh:lo_orderdateWeeknuminyear19946 ).

}  

3.5.8 OLAP4LD-QB Q2.1 (4)

PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select  ?rdfh_lo_orderdate ?rdfh_lo_partkey1 sum(?rdfh_lo_revenue) as ?lo_revenue

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 

where {  

?obs qb:dataSet rdfh-inst:ds.  
?obs rdfh:lo_orderdate  ?rdfh_lo_orderdate0. 
?rdfh_lo_orderdate1 skos:narrower ?rdfh_lo_orderdate0.
?rdfh_lo_orderdate2 skos:narrower ?rdfh_lo_orderdate1. 
?rdfh_lo_orderdate skos:narrower ?rdfh_lo_orderdate2.  
rdfh:lo_orderdateYearLevel skos:member ?rdfh_lo_orderdate. 

?obs rdfh:lo_partkey ?rdfh_lo_partkey0.
?rdfh_lo_partkey1 skos:narrower ?rdfh_lo_partkey0.
?rdfh_lo_partkey skos:narrower ?rdfh_lo_partkey1.
rdfh:lo_partkeyCategoryLevel skos:member ?rdfh_lo_partkey.
 
?obs rdfh:lo_suppkey ?rdfh_lo_suppkey0.
?rdfh_lo_suppkey1 skos:narrower ?rdfh_lo_suppkey0.
?rdfh_lo_suppkey2 skos:narrower ?rdfh_lo_suppkey1.
?rdfh_lo_suppkey skos:narrower ?rdfh_lo_suppkey2.
rdfh:lo_suppkeyRegionLevel skos:member ?rdfh_lo_suppkey.
 
?obs rdfh:lo_revenue ?rdfh_lo_revenue. 

FILTER(?rdfh_lo_partkey = rdfh:lo_partkeyCategoryMFGR-12 ).
FILTER(?rdfh_lo_suppkey = rdfh:lo_suppkeyRegionAMERICA ).

} group by ?rdfh_lo_orderdate ?rdfh_lo_partkey1 order by ?rdfh_lo_orderdate ?rdfh_lo_partkey1 

3.5.9 OLAP4LD-QB Q2.2 (5)

PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 
select  ?rdfh_lo_orderdate ?rdfh_lo_partkey sum(?rdfh_lo_revenue) as ?lo_revenue

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 

where {  

?obs qb:dataSet rdfh-inst:ds.  
?obs rdfh:lo_orderdate  ?rdfh_lo_orderdate0. 
?rdfh_lo_orderdate1 skos:narrower ?rdfh_lo_orderdate0.
?rdfh_lo_orderdate2 skos:narrower ?rdfh_lo_orderdate1. 
?rdfh_lo_orderdate skos:narrower ?rdfh_lo_orderdate2.  
rdfh:lo_orderdateYearLevel skos:member ?rdfh_lo_orderdate. 

?obs rdfh:lo_partkey ?rdfh_lo_partkey0.
?rdfh_lo_partkey skos:narrower ?rdfh_lo_partkey0.
rdfh:lo_partkeyBrand1Level skos:member ?rdfh_lo_partkey.
 
?obs rdfh:lo_suppkey ?rdfh_lo_suppkey0.
?rdfh_lo_suppkey1 skos:narrower ?rdfh_lo_suppkey0.
?rdfh_lo_suppkey2 skos:narrower ?rdfh_lo_suppkey1.
?rdfh_lo_suppkey skos:narrower ?rdfh_lo_suppkey2.
 
?obs rdfh:lo_revenue ?rdfh_lo_revenue. 

FILTER ( str(?rdfh_lo_partkey) >= rdfh:lo_partkeyBrand1MFGR-2221 and str(?rdfh_lo_partkey) <= rdfh:lo_partkeyBrand1MFGR-2228)
FILTER(?rdfh_lo_suppkey = rdfh:lo_suppkeyRegionASIA ).

} group by ?rdfh_lo_orderdate ?rdfh_lo_partkey order by ?rdfh_lo_orderdate ?rdfh_lo_partkey 

3.5.10 OLAP4LD-QB Q2.3 (6)

PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 
select  ?rdfh_lo_orderdate ?rdfh_lo_partkey sum(?rdfh_lo_revenue) as ?lo_revenue 

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 

where {  

?obs qb:dataSet rdfh-inst:ds.  
?obs rdfh:lo_orderdate  ?rdfh_lo_orderdate0. 
?rdfh_lo_orderdate1 skos:narrower ?rdfh_lo_orderdate0.
?rdfh_lo_orderdate2 skos:narrower ?rdfh_lo_orderdate1.  
?rdfh_lo_orderdate skos:narrower ?rdfh_lo_orderdate2.  
rdfh:lo_orderdateYearLevel skos:member ?rdfh_lo_orderdate. 

?obs rdfh:lo_partkey ?rdfh_lo_partkey0.
?rdfh_lo_partkey skos:narrower ?rdfh_lo_partkey0.
rdfh:lo_partkeyBrand1Level skos:member ?rdfh_lo_partkey.
 
?obs rdfh:lo_suppkey ?rdfh_lo_suppkey0.
?rdfh_lo_suppkey1 skos:narrower ?rdfh_lo_suppkey0.
?rdfh_lo_suppkey2 skos:narrower ?rdfh_lo_suppkey1.
?rdfh_lo_suppkey skos:narrower ?rdfh_lo_suppkey2.
rdfh:lo_suppkeyRegionLevel skos:member ?rdfh_lo_suppkey.
 
?obs rdfh:lo_revenue ?rdfh_lo_revenue. 

FILTER ( ?rdfh_lo_partkey = rdfh:lo_partkeyBrand1MFGR-2239)
FILTER(?rdfh_lo_suppkey = rdfh:lo_suppkeyRegionEUROPE ).

} group by ?rdfh_lo_orderdate ?rdfh_lo_partkey order by ?rdfh_lo_orderdate ?rdfh_lo_partkey 

3.5.11 OLAP4LD-QB Q3.1 (7)

PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select ?c_nation ?s_nation ?d_year sum(?rdfh_lo_revenue) as ?lo_revenue  

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 

where {  

?obs qb:dataSet rdfh-inst:ds.  
?obs rdfh:lo_orderdate  ?d_date. 
?d_yearmonthnum skos:narrower ?d_date.
?d_yearmonth skos:narrower  ?d_yearmonthnum. 
?d_year skos:narrower  ?d_yearmonth.  
rdfh:lo_orderdateYearLevel skos:member  ?d_year. 

?obs rdfh:lo_custkey ?c_customer.
?c_city skos:narrower  ?c_customer.
?c_nation skos:narrower  ?c_city.
?c_region skos:narrower  ?c_nation.
rdfh:lo_custkeyRegionLevel skos:member  ?c_region.
 
?obs rdfh:lo_suppkey ?s_supplier.
?s_city skos:narrower  ?s_supplier.
?s_nation skos:narrower  ?s_city.
?s_region skos:narrower  ?s_nation.
rdfh:lo_suppkeyRegionLevel skos:member  ?s_region.
 
?obs rdfh:lo_revenue ?rdfh_lo_revenue. 

FILTER(?c_region = rdfh:lo_custkeyRegionASIA ).
FILTER(?s_region = rdfh:lo_suppkeyRegionASIA ).
FILTER(str(?d_year) >= "http://lod2.eu/schemas/rdfh#lo_orderdateYear1992" and str(?d_year) <= "http://lod2.eu/schemas/rdfh#lo_orderdateYear1997").

} group by ?d_year ?c_nation ?s_nation order by asc(?d_year) desc(?lo_revenue) 

3.5.12 OLAP4LD-QB Q3.2 (8)

PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select ?c_city ?s_city ?d_year sum(?rdfh_lo_revenue) as ?lo_revenue  

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 

where {  

?obs qb:dataSet rdfh-inst:ds.  
?obs rdfh:lo_orderdate  ?d_date. 
?d_yearmonthnum skos:narrower  ?d_date.
?d_yearmonth skos:narrower  ?d_yearmonthnum. 
?d_year skos:narrower  ?d_yearmonth.  
rdfh:lo_orderdateYearLevel skos:member  ?d_year. 

?obs rdfh:lo_custkey ?c_customer.
?c_city skos:narrower  ?c_customer.
?c_nation skos:narrower  ?c_city.
?c_region skos:narrower  ?c_nation.
rdfh:lo_custkeyRegionLevel skos:member  ?c_region.
 
?obs rdfh:lo_suppkey ?s_supplier.
?s_city skos:narrower  ?s_supplier.
?s_nation skos:narrower  ?s_city.
?s_region skos:narrower  ?s_nation.
rdfh:lo_suppkeyRegionLevel skos:member  ?s_region.
 
?obs rdfh:lo_revenue ?rdfh_lo_revenue. 

FILTER(?c_nation = rdfh:lo_custkeyNationUNITED-STATES ).
FILTER(?s_nation = rdfh:lo_suppkeyNationUNITED-STATES ).
FILTER(str(?d_year) >= "http://lod2.eu/schemas/rdfh#lo_orderdateYear1992" and str(?d_year) <= "http://lod2.eu/schemas/rdfh#lo_orderdateYear1997").

} group by ?d_year ?c_city ?s_city order by asc(?d_year) desc(?lo_revenue) 

3.5.13 OLAP4LD-QB Q3.3 (9)

PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select ?c_city ?s_city ?d_year sum(?rdfh_lo_revenue) as ?lo_revenue  

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 

where {  

?obs qb:dataSet rdfh-inst:ds.  
?obs rdfh:lo_orderdate  ?d_date. 
?d_yearmonthnum skos:narrower  ?d_date.
?d_yearmonth skos:narrower  ?d_yearmonthnum. 
?d_year skos:narrower  ?d_yearmonth.  
rdfh:lo_orderdateYearLevel skos:member  ?d_year. 

?obs rdfh:lo_custkey ?c_customer.
?c_city skos:narrower  ?c_customer.
?c_nation skos:narrower  ?c_city.
?c_region skos:narrower  ?c_nation.
rdfh:lo_custkeyRegionLevel skos:member  ?c_region.
 
?obs rdfh:lo_suppkey ?s_supplier.
?s_city skos:narrower  ?s_supplier.
?s_nation skos:narrower  ?s_city.
?s_region skos:narrower  ?s_nation.
rdfh:lo_suppkeyRegionLevel skos:member  ?s_region.
 
?obs rdfh:lo_revenue ?rdfh_lo_revenue. 

FILTER(?c_city = rdfh:lo_custkeyCityUNITED-KI1 OR ?c_city = rdfh:lo_custkeyCityUNITED-KI5).
FILTER(?s_city = rdfh:lo_suppkeyCityUNITED-KI1 OR ?s_city = rdfh:lo_suppkeyCityUNITED-KI5).
FILTER(str(?d_year) >= "http://lod2.eu/schemas/rdfh#lo_orderdateYear1992" and str(?d_year) <= "http://lod2.eu/schemas/rdfh#lo_orderdateYear1997").

} group by ?d_year ?c_city ?s_city order by asc(?d_year) desc(?lo_revenue) 

3.5.14 OLAP4LD-QB Q3.4 (10)

PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select ?c_city ?s_city ?d_year sum(?rdfh_lo_revenue) as ?lo_revenue  

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 

where {  

?obs qb:dataSet rdfh-inst:ds.  
?obs rdfh:lo_orderdate  ?d_date. 
?d_yearmonthnum skos:narrower  ?d_date.
?d_yearmonth skos:narrower  ?d_yearmonthnum. 
?d_year skos:narrower  ?d_yearmonth.  
rdfh:lo_orderdateYearLevel skos:member  ?d_year. 

?obs rdfh:lo_custkey ?c_customer.
?c_city skos:narrower  ?c_customer.
rdfh:lo_custkeyCityLevel skos:member  ?c_city.
 
?obs rdfh:lo_suppkey ?s_supplier.
?s_city skos:narrower  ?s_supplier.
rdfh:lo_suppkeyCityLevel skos:member  ?s_city.
 
?obs rdfh:lo_revenue ?rdfh_lo_revenue. 

FILTER(?c_city = rdfh:lo_custkeyCityUNITED-KI1 OR ?c_city = rdfh:lo_custkeyCityUNITED-KI5).
FILTER(?s_city = rdfh:lo_suppkeyCityUNITED-KI1 OR ?s_city = rdfh:lo_suppkeyCityUNITED-KI5).
FILTER(?d_yearmonth = rdfh:lo_orderdateYearMonthDec1997).

} group by ?d_year ?c_city ?s_city order by asc(?d_year) desc(?lo_revenue) 


3.5.15 OLAP4LD-QB Q4.1 (11)

PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select ?d_year ?c_nation sum(?lo_revenue - ?lo_supplycost) as ?sum_profit  

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 

where {  

?obs qb:dataSet rdfh-inst:ds.  
?obs rdfh:lo_orderdate  ?d_date. 
?d_yearmonthnum skos:narrower  ?d_date.
?d_yearmonth skos:narrower  ?d_yearmonthnum. 
?d_year skos:narrower  ?d_yearmonth.  
rdfh:lo_orderdateYearLevel skos:member  ?d_year. 

?obs rdfh:lo_custkey ?c_customer.
?c_city skos:narrower  ?c_customer.
?c_nation skos:narrower  ?c_city.
?c_region skos:narrower  ?c_nation.
rdfh:lo_custkeyRegionLevel skos:member  ?c_region.

?obs rdfh:lo_partkey ?p_part.
?p_brand1 skos:narrower  ?p_part. 
?p_category skos:narrower  ?p_brand1.
?p_mfgr skos:narrower  ?p_category.
rdfh:lo_partkeyMfgrLevel skos:member  ?p_mfgr.
 
?obs rdfh:lo_suppkey ?s_supplier.
?s_city skos:narrower  ?s_supplier.
?s_nation skos:narrower  ?s_city.
?s_region skos:narrower  ?s_nation.
rdfh:lo_suppkeyRegionLevel skos:member  ?s_region.
 
?obs rdfh:lo_revenue ?lo_revenue.
?obs rdfh:lo_supplycost ?lo_supplycost. 

FILTER(?c_region = rdfh:lo_custkeyRegionAMERICA).
FILTER(?s_region = rdfh:lo_suppkeyRegionAMERICA).
FILTER (?p_mfgr = rdfh:lo_partkeyMfgrMFGR-1 OR ?p_mfgr = rdfh:lo_partkeyMfgrMFGR-2).

} group by ?d_year ?c_nation order by ?d_year ?c_nation  

3.5.16 OLAP4LD-QB Q4.2 (12)

PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select ?d_year ?s_nation ?p_category sum(?lo_revenue - ?lo_supplycost) as ?sum_profit  

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 

where {  

?obs qb:dataSet rdfh-inst:ds.  
?obs rdfh:lo_orderdate  ?d_date. 
?d_yearmonthnum skos:narrower  ?d_date.
?d_yearmonth skos:narrower  ?d_yearmonthnum. 
?d_year skos:narrower  ?d_yearmonth.  
rdfh:lo_orderdateYearLevel skos:member  ?d_year. 

?obs rdfh:lo_custkey ?c_customer.
?c_city skos:narrower  ?c_customer.
?c_nation skos:narrower  ?c_city.
?c_region skos:narrower  ?c_nation.
rdfh:lo_custkeyRegionLevel skos:member  ?c_region.

?obs rdfh:lo_partkey ?p_part.
?p_brand1 skos:narrower  ?p_part.
?p_category skos:narrower  ?p_brand1.
?p_mfgr skos:narrower  ?p_category.
rdfh:lo_partkeyMfgrLevel skos:member  ?p_mfgr.
 
?obs rdfh:lo_suppkey ?s_supplier.
?s_city skos:narrower  ?s_supplier.
?s_nation skos:narrower  ?s_city.
?s_region skos:narrower  ?s_nation.
rdfh:lo_suppkeyRegionLevel skos:member  ?s_region.
 
?obs rdfh:lo_revenue ?lo_revenue.
?obs rdfh:lo_supplycost ?lo_supplycost.  

FILTER(?d_year = rdfh:lo_orderdateYear1997 OR ?d_year = rdfh:lo_orderdateYear1998).
FILTER(?c_region = rdfh:lo_custkeyRegionAMERICA).
FILTER(?s_region = rdfh:lo_suppkeyRegionAMERICA).
FILTER (?p_mfgr = rdfh:lo_partkeyMfgrMFGR-1 OR ?p_mfgr = rdfh:lo_partkeyMfgrMFGR-2).

} group by ?d_year ?s_nation ?p_category order by ?d_year ?s_nation ?p_category  

3.5.17 OLAP4LD-QB Q4.3 (13)

PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select ?d_year ?s_city ?p_brand1 sum(?lo_revenue - ?lo_supplycost) as ?sum_profit  

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 

where {  

?obs qb:dataSet rdfh-inst:ds.  
?obs rdfh:lo_orderdate  ?d_date. 
?d_yearmonthnum skos:narrower ?d_date.
?d_yearmonth skos:narrower  ?d_yearmonthnum. 
?d_year skos:narrower  ?d_yearmonth.  
rdfh:lo_orderdateYearLevel skos:member  ?d_year. 

?obs rdfh:lo_custkey ?c_customer.
?c_city skos:narrower  ?c_customer.
?c_nation skos:narrower  ?c_city.
?c_region skos:narrower  ?c_nation.
rdfh:lo_custkeyRegionLevel skos:member  ?c_region.

?obs rdfh:lo_partkey ?p_part.
?p_brand1 skos:narrower  ?p_part.
?p_category skos:narrower  ?p_brand1.
?p_mfgr skos:narrower  ?p_category.
rdfh:lo_partkeyMfgrLevel skos:member  ?p_mfgr.
 
?obs rdfh:lo_suppkey ?s_supplier.
?s_city skos:narrower  ?s_supplier.
?s_nation skos:narrower  ?s_city.
?s_region skos:narrower  ?s_nation.
rdfh:lo_suppkeyRegionLevel skos:member  ?s_region.
 
?obs rdfh:lo_revenue ?lo_revenue.
?obs rdfh:lo_supplycost ?lo_supplycost.  

FILTER(?d_year = rdfh:lo_orderdateYear1997 OR ?d_year = rdfh:lo_orderdateYear1998).
FILTER(?c_region = rdfh:lo_custkeyRegionAMERICA).
FILTER (?p_category = rdfh:lo_partkeyCategoryMFGR-14 ).
FILTER(?s_nation = rdfh:lo_suppkeyNationUNITED-STATES).

} group by ?d_year ?s_city ?p_brand1 order by ?d_year ?s_city ?p_brand1  

3.6 OLAP4LD-QB-M

BIBM command:
java -classpath .:* com.openlinksw.bibm.tpch.TestDriver -uc ../ssb/olap4ldSPARQLAggViews/ -q -defaultparams -mt 1 -scale 1 http://aifb-ls3-remus.aifb.kit.edu:8890/sparql
Tools: Sed command line program for modifying the OLAP4LD-SSB RDF to reuse QB (adding links):
sed 's/a rdfh:lineorder ;/a rdfh:lineorder ;  ;/g' lineorder.ttl > lineorder_qb.ttl
			
			
			
			
			
			
Files: Preparation time: Rows/Triples: Results: For each SSB query, we now first list the SPARQL INSERT query that creates the data for the view, and then we list the SPARQL query that uses the view:

3.6.1 OLAP4LD-QB-M Q1.1 (1)

Create query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

INSERT INTO GRAPH <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted1> {

rdfh-inst:query1-aggview qb:observation _:obs.  
_:obs rdfh:lo_orderdate ?d_year.
_:obs rdfh:lo_custkey rdfh:lo_custkeyAllAll.
_:obs rdfh:lo_partkey rdfh:lo_partkeyAllAll.
_:obs rdfh:lo_suppkey rdfh:lo_suppkeyAllAll.
_:obs rdfh:lo_quantity ?rdfh_lo_quantity. 
_:obs rdfh:lo_discount ?rdfh_lo_discount.
_:obs rdfh:sum_revenue ?sum_revenue. 

}

where {  

{

select ?d_year ?rdfh_lo_quantity ?rdfh_lo_discount sum(?rdfh_lo_extendedprice * ?rdfh_lo_discount) as ?sum_revenue 

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 

where {

?obs qb:dataSet rdfh-inst:ds. 

?obs rdfh:lo_orderdate  ?d_date. 
?d_date skos:narrower ?d_yearmonthnum.
?d_yearmonthnum skos:narrower ?d_yearmonth.
?d_yearmonth skos:narrower ?d_year. 
?d_year skos:member rdfh:lo_orderdateYearLevel. 

?obs rdfh:lo_extendedprice ?rdfh_lo_extendedprice. 

?obs rdfh:lo_discount ?rdfh_lo_discount. 

?obs rdfh:lo_quantity ?rdfh_lo_quantity.

} group by ?d_year ?rdfh_lo_quantity ?rdfh_lo_discount 
}
}
Read query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select sum(?rdfh_sum_revenue) as ?sum_revenue

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 
from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted1> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted2> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted3> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted4> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted7> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted8> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted10> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted11> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted12> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted13> 

where {  

rdfh-inst:ds qb:slice ?slice.
?slice qb:observation ?obs; 
	rdfh:lo_custkey <http://lod2.eu/schemas/rdfh#lo_custkeyAllAll>;
	rdfh:lo_partkey <http://lod2.eu/schemas/rdfh#lo_partkeyAllAll>;
	rdfh:lo_suppkey <http://lod2.eu/schemas/rdfh#lo_suppkeyAllAll>.

?obs <http://lod2.eu/schemas/rdfh#lo_orderdate>  ?rdfh_lo_orderdate.   
<http://lod2.eu/schemas/rdfh#lo_orderdateYearLevel>  skos:member ?rdfh_lo_orderdate. 

?obs <http://lod2.eu/schemas/rdfh#lo_discount> ?rdfh_lo_discount. 

?obs <http://lod2.eu/schemas/rdfh#lo_quantity> ?rdfh_lo_quantity. 

?obs <http://lod2.eu/schemas/rdfh#sum_revenue> ?rdfh_sum_revenue. 

FILTER(?rdfh_lo_quantity <= 24). 
FILTER(?rdfh_lo_discount >= 1 AND ?rdfh_lo_discount <= 3). 
FILTER(?rdfh_lo_orderdate = <http://lod2.eu/schemas/rdfh#lo_orderdateYear1993> ).

}

3.6.2 OLAP4LD-QB-M Q1.2 (2)

Create query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

INSERT INTO GRAPH <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted4> {

rdfh-inst:query2-aggview qb:observation _:obs.  
_:obs rdfh:lo_orderdate ?d_yearmonthnum.
_:obs rdfh:lo_custkey rdfh:lo_custkeyAllAll.
_:obs rdfh:lo_partkey rdfh:lo_partkeyAllAll.
_:obs rdfh:lo_suppkey rdfh:lo_suppkeyAllAll.
_:obs rdfh:lo_quantity ?rdfh_lo_quantity. 
_:obs rdfh:lo_discount ?rdfh_lo_discount.
_:obs rdfh:sum_revenue ?sum_revenue. 

}

where {  

{

select ?d_yearmonthnum ?rdfh_lo_quantity ?rdfh_lo_discount sum(?rdfh_lo_extendedprice * ?rdfh_lo_discount) as ?sum_revenue 

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 

where {

?obs qb:dataSet rdfh-inst:ds. 

?obs rdfh:lo_orderdate  ?d_date. 
?d_date skos:narrower ?d_yearmonthnum.
?d_yearmonthnum skos:member rdfh:lo_orderdateYearMonthNumLevel. 

?obs rdfh:lo_extendedprice ?rdfh_lo_extendedprice. 

?obs rdfh:lo_discount ?rdfh_lo_discount. 

?obs rdfh:lo_quantity ?rdfh_lo_quantity.

} group by ?d_yearmonthnum ?rdfh_lo_quantity ?rdfh_lo_discount 
}
}
Read query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select sum(?rdfh_sum_revenue) as ?sum_revenue

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels>  
from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted1> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted2> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted3> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted4> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted7> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted8> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted10> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted11> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted12> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted13> 

where {  

rdfh-inst:ds qb:slice ?slice.
?slice qb:observation ?obs; 
	rdfh:lo_custkey <http://lod2.eu/schemas/rdfh#lo_custkeyAllAll>;
	rdfh:lo_partkey <http://lod2.eu/schemas/rdfh#lo_partkeyAllAll>;
	rdfh:lo_suppkey <http://lod2.eu/schemas/rdfh#lo_suppkeyAllAll>.
 
?obs <http://lod2.eu/schemas/rdfh#lo_orderdate> ?rdfh_lo_orderdate. 
<http://lod2.eu/schemas/rdfh#lo_orderdateYearMonthNumLevel>  skos:member ?rdfh_lo_orderdate.

?obs <http://lod2.eu/schemas/rdfh#lo_discount> ?rdfh_lo_discount. 

?obs <http://lod2.eu/schemas/rdfh#lo_quantity> ?rdfh_lo_quantity.

?obs <http://lod2.eu/schemas/rdfh#sum_revenue> ?rdfh_sum_revenue.  

FILTER(?rdfh_lo_quantity >= 26 AND ?rdfh_lo_quantity <= 35). 
FILTER(?rdfh_lo_discount >= 4 AND ?rdfh_lo_discount <= 6). 
FILTER(?rdfh_lo_orderdate = <http://lod2.eu/schemas/rdfh#lo_orderdateYearMonthNum199401> ).

}  
    

3.6.3 OLAP4LD-QB-M Q1.3 (3)

Create query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

INSERT INTO GRAPH <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted13> {

rdfh-inst:query3-aggview qb:observation _:obs.  
_:obs rdfh:lo_orderdate ?d_weeknuminyear.
_:obs rdfh:lo_custkey rdfh:lo_custkeyAllAll.
_:obs rdfh:lo_partkey rdfh:lo_partkeyAllAll.
_:obs rdfh:lo_suppkey rdfh:lo_suppkeyAllAll.
_:obs rdfh:lo_quantity ?rdfh_lo_quantity. 
_:obs rdfh:lo_discount ?rdfh_lo_discount.
_:obs rdfh:sum_revenue ?sum_revenue. 

}

where {  

{

select ?d_weeknuminyear ?rdfh_lo_quantity ?rdfh_lo_discount sum(?rdfh_lo_extendedprice * ?rdfh_lo_discount) as ?sum_revenue 

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 

where {

?obs qb:dataSet rdfh-inst:ds. 

?obs rdfh:lo_orderdate  ?d_date. 
?d_date skos:narrower ?d_weeknuminyear. 
?d_weeknuminyear skos:member rdfh:lo_orderdateWeeknuminyearLevel. 

?obs rdfh:lo_extendedprice ?rdfh_lo_extendedprice. 

?obs rdfh:lo_discount ?rdfh_lo_discount. 

?obs rdfh:lo_quantity ?rdfh_lo_quantity.

} group by ?d_weeknuminyear ?rdfh_lo_quantity ?rdfh_lo_discount 
}
}
Read query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select sum(?rdfh_sum_revenue) as ?sum_revenue

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels>  
from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted1> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted2> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted3> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted4> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted7> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted8> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted10> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted11> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted12> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted13>

where {  

rdfh-inst:ds qb:slice ?slice.
?slice qb:observation ?obs; 
	rdfh:lo_custkey <http://lod2.eu/schemas/rdfh#lo_custkeyAllAll>;
	rdfh:lo_partkey <http://lod2.eu/schemas/rdfh#lo_partkeyAllAll>;
	rdfh:lo_suppkey <http://lod2.eu/schemas/rdfh#lo_suppkeyAllAll>.

?obs rdfh:lo_orderdate  ?rdfh_lo_orderdate. 
rdfh:lo_orderdateWeeknuminyearLevel skos:member ?rdfh_lo_orderdate.

?obs rdfh:lo_discount ?rdfh_lo_discount.

?obs rdfh:lo_quantity ?rdfh_lo_quantity.

?obs rdfh:sum_revenue ?rdfh_sum_revenue.  

FILTER(?rdfh_lo_quantity >= 26 AND ?rdfh_lo_quantity <= 35). 
FILTER(?rdfh_lo_discount >= 5 AND ?rdfh_lo_discount <= 7). 
FILTER(?rdfh_lo_orderdate = rdfh:lo_orderdateWeeknuminyear19946 ).

}  

3.6.4 OLAP4LD-QB-M Q2.1 (4)

Create query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

INSERT INTO GRAPH <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted2> {

rdfh-inst:query4-aggview qb:observation _:obs.  
_:obs rdfh:lo_orderdate ?d_year.
_:obs rdfh:lo_custkey rdfh:lo_custkeyAllAll.
_:obs rdfh:lo_partkey ?p_brand1.
_:obs rdfh:lo_suppkey ?s_region.
_:obs rdfh:lo_quantity rdfh:lo_quantityAllAll. 
_:obs rdfh:lo_discount rdfh:lo_discountAllAll.
_:obs rdfh:lo_revenue ?lo_revenue. 

}

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 

where {  

{

select ?d_year ?p_brand1 ?s_region sum(?rdfh_lo_revenue) as ?lo_revenue

where {

?obs qb:dataSet rdfh-inst:ds. 
?obs rdfh:lo_orderdate  ?d_date. 
?d_yearmonthnum skos:narrower  ?d_date.
?d_yearmonth skos:narrower  ?d_yearmonthnum. 
?d_year skos:narrower  ?d_yearmonth.  
rdfh:lo_orderdateYearLevel skos:member  ?d_year. 

?obs rdfh:lo_partkey ?p_part.
?p_brand1 skos:narrower  ?p_part.
rdfh:lo_partkeyBrand1Level skos:member  ?p_brand1.
 
?obs rdfh:lo_suppkey ?s_supplier.
?s_city skos:narrower  ?s_supplier.
?s_nation skos:narrower  ?s_city.
?s_region skos:narrower  ?s_nation.
rdfh:lo_suppkeyRegionLevel skos:member  ?s_region.
 
?obs rdfh:lo_revenue ?rdfh_lo_revenue. 

} group by ?d_year ?p_brand1 ?s_region

}

} 
Read query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select  ?d_year ?p_brand1 sum(?rdfh_lo_revenue) as ?lo_revenue

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 
from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted1> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted2> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted3> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted4> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted7> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted8> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted10> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted11> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted12> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted13> 

where {  

rdfh-inst:ds qb:slice ?slice.
?slice qb:observation ?obs; 
	rdfh:lo_custkey <http://lod2.eu/schemas/rdfh#lo_custkeyAllAll>;
	rdfh:lo_quantity <http://lod2.eu/schemas/rdfh#lo_quantityAllAll>;
	rdfh:lo_discount <http://lod2.eu/schemas/rdfh#lo_discountAllAll>.
 
?obs rdfh:lo_orderdate  ?d_year.   
rdfh:lo_orderdateYearLevel skos:member ?d_year. 

?obs rdfh:lo_partkey ?p_brand1.
?p_category skos:narrower  ?p_brand1.
rdfh:lo_partkeyCategoryLevel skos:member  ?p_category.
 
?obs rdfh:lo_suppkey ?s_region.
rdfh:lo_suppkeyRegionLevel skos:member  ?s_region.
 
?obs rdfh:lo_revenue ?rdfh_lo_revenue. 

FILTER(?p_category = rdfh:lo_partkeyCategoryMFGR-12 ).
FILTER(?s_region = rdfh:lo_suppkeyRegionAMERICA ).

} group by ?d_year ?p_brand1 order by ?d_year ?p_brand1 

3.6.5 OLAP4LD-QB-M Q2.2 (5)

Create query is the same as for Q2.1. Read query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 
select  ?rdfh_lo_orderdate ?rdfh_lo_partkey sum(?rdfh_lo_revenue) as ?lo_revenue

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 
from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted1> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted2> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted3> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted4> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted7> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted8> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted10> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted11> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted12> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted13> 

where {  

rdfh-inst:ds qb:slice ?slice.
?slice qb:observation ?obs; 
	rdfh:lo_custkey <http://lod2.eu/schemas/rdfh#lo_custkeyAllAll>;
	rdfh:lo_quantity <http://lod2.eu/schemas/rdfh#lo_quantityAllAll>;
	rdfh:lo_discount <http://lod2.eu/schemas/rdfh#lo_discountAllAll>. 

?obs rdfh:lo_orderdate  ?rdfh_lo_orderdate.
rdfh:lo_orderdateYearLevel skos:member  ?rdfh_lo_orderdate. 

?obs rdfh:lo_partkey ?rdfh_lo_partkey.
rdfh:lo_partkeyBrand1Level skos:member  ?rdfh_lo_partkey.
 
?obs rdfh:lo_suppkey ?rdfh_lo_suppkey.
rdfh:lo_suppkeyRegionLevel skos:member  ?rdfh_lo_suppkey.
 
?obs rdfh:lo_revenue ?rdfh_lo_revenue. 

FILTER ( str(?rdfh_lo_partkey) >= rdfh:lo_partkeyBrand1MFGR-2221 and str(?rdfh_lo_partkey) <= rdfh:lo_partkeyBrand1MFGR-2228)
FILTER(?rdfh_lo_suppkey = rdfh:lo_suppkeyRegionASIA ).

} group by ?rdfh_lo_orderdate ?rdfh_lo_partkey order by ?rdfh_lo_orderdate ?rdfh_lo_partkey 

3.6.6 OLAP4LD-QB-M Q2.3 (6)

Create query is the same as for Q2.1. Read query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select  ?rdfh_lo_orderdate ?rdfh_lo_partkey sum(?rdfh_lo_revenue) as ?lo_revenue

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 
from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted1> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted2> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted3> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted4> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted7> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted8> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted10> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted11> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted12> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted13> 

where {  

rdfh-inst:ds qb:slice ?slice.
?slice qb:observation ?obs; 
	rdfh:lo_custkey <http://lod2.eu/schemas/rdfh#lo_custkeyAllAll>;
	rdfh:lo_quantity <http://lod2.eu/schemas/rdfh#lo_quantityAllAll>;
	rdfh:lo_discount <http://lod2.eu/schemas/rdfh#lo_discountAllAll>.  

?obs rdfh:lo_orderdate ?rdfh_lo_orderdate.   
rdfh:lo_orderdateYearLevel skos:member  ?rdfh_lo_orderdate. 

?obs rdfh:lo_partkey ?rdfh_lo_partkey.
rdfh:lo_partkeyBrand1Level skos:member  ?rdfh_lo_partkey.
 
?obs rdfh:lo_suppkey ?rdfh_lo_suppkey.
rdfh:lo_suppkeyRegionLevel skos:member  ?rdfh_lo_suppkey.
 
?obs rdfh:lo_revenue ?rdfh_lo_revenue. 

FILTER ( ?rdfh_lo_partkey = rdfh:lo_partkeyBrand1MFGR-2239)
FILTER(?rdfh_lo_suppkey = rdfh:lo_suppkeyRegionEUROPE ).

} group by ?rdfh_lo_orderdate ?rdfh_lo_partkey order by ?rdfh_lo_orderdate ?rdfh_lo_partkey 

3.6.7 OLAP4LD-QB-M Q3.1 (7)

Create query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 


INSERT INTO GRAPH <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted7> {

rdfh-inst:query7-aggview qb:observation _:obs.  
_:obs rdfh:lo_orderdate ?d_year.
_:obs rdfh:lo_custkey ?c_nation.
_:obs rdfh:lo_partkey rdfh:lo_partkeyAllAll.
_:obs rdfh:lo_suppkey ?s_nation.
_:obs rdfh:lo_quantity rdfh:lo_quantityAllAll. 
_:obs rdfh:lo_discount rdfh:lo_discountAllAll.
_:obs rdfh:lo_revenue ?lo_revenue. 

}
from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 
where {  

{

select ?d_year ?c_nation ?s_nation sum(?rdfh_lo_revenue) as ?lo_revenue

where {

?obs qb:dataSet rdfh-inst:ds. 

?obs rdfh:lo_orderdate  ?d_date. 
?d_date skos:narrower ?d_yearmonthnum.
?d_yearmonthnum skos:narrower ?d_yearmonth. 
?d_yearmonth skos:narrower ?d_year.  
?d_year skos:member rdfh:lo_orderdateYearLevel. 

?obs rdfh:lo_custkey ?c_customer.
?c_customer skos:narrower ?c_city.
?c_city skos:narrower ?c_nation.
?c_nation skos:member rdfh:lo_custkeyNationLevel.

?obs rdfh:lo_suppkey ?s_supplier.
?s_supplier skos:narrower ?s_city.
?s_city skos:narrower ?s_nation.
?s_nation skos:member rdfh:lo_suppkeyNationLevel.

?obs rdfh:lo_revenue ?rdfh_lo_revenue.

} group by ?d_year ?c_nation ?s_nation
}
}
Read query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select ?c_nation ?s_nation ?d_year sum(?rdfh_lo_revenue) as ?lo_revenue  

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 
from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted1> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted2> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted3> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted4> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted7> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted8> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted10> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted11> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted12> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted13> 

where {  

rdfh-inst:ds qb:slice ?slice.
?slice qb:observation ?obs; 
	rdfh:lo_partkey <http://lod2.eu/schemas/rdfh#lo_partkeyAllAll>;
	rdfh:lo_quantity <http://lod2.eu/schemas/rdfh#lo_quantityAllAll>;
	rdfh:lo_discount <http://lod2.eu/schemas/rdfh#lo_discountAllAll>.

?obs rdfh:lo_orderdate ?d_year.  
rdfh:lo_orderdateYearLevel skos:member  ?d_year. 

?obs rdfh:lo_custkey ?c_nation.
?c_region skos:narrower  ?c_nation.
rdfh:lo_custkeyRegionLevel skos:member  ?c_region.
 
?obs rdfh:lo_suppkey ?s_nation.
?s_region skos:narrower  ?s_nation. 
rdfh:lo_suppkeyRegionLevel skos:member  ?s_region.
 
?obs rdfh:lo_revenue ?rdfh_lo_revenue. 

FILTER(?c_region = rdfh:lo_custkeyRegionASIA ).
FILTER(?s_region = rdfh:lo_suppkeyRegionASIA ).
FILTER(str(?d_year) >= "http://lod2.eu/schemas/rdfh#lo_orderdateYear1992" and str(?d_year) <= "http://lod2.eu/schemas/rdfh#lo_orderdateYear1997").

} group by ?d_year ?c_nation ?s_nation order by asc(?d_year) desc(?lo_revenue) 

3.6.8 OLAP4LD-QB-M Q3.2 (8)

Create query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 


INSERT INTO GRAPH <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted8> {

rdfh-inst:query8-aggview qb:observation _:obs.  
_:obs rdfh:lo_orderdate ?d_year.
_:obs rdfh:lo_custkey ?c_city.
_:obs rdfh:lo_partkey rdfh:lo_partkeyAllAll.
_:obs rdfh:lo_suppkey ?s_city.
_:obs rdfh:lo_quantity rdfh:lo_quantityAllAll. 
_:obs rdfh:lo_discount rdfh:lo_discountAllAll.
_:obs rdfh:lo_revenue ?lo_revenue. 

}
from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 
where {  

{

select ?d_year ?c_city ?s_city sum(?rdfh_lo_revenue) as ?lo_revenue

where {

?obs qb:dataSet rdfh-inst:ds. 

?obs rdfh:lo_orderdate  ?d_date. 
?d_date skos:narrower ?d_yearmonthnum.
?d_yearmonthnum skos:narrower ?d_yearmonth. 
?d_yearmonth skos:narrower ?d_year.  
?d_year skos:member rdfh:lo_orderdateYearLevel. 

?obs rdfh:lo_custkey ?c_customer.
?c_customer skos:narrower ?c_city.
?c_city skos:member rdfh:lo_custkeyCityLevel.

?obs rdfh:lo_suppkey ?s_supplier.
?s_supplier skos:narrower ?s_city.
?s_city skos:member rdfh:lo_suppkeyCityLevel.

?obs rdfh:lo_revenue ?rdfh_lo_revenue.

} group by ?d_year ?c_city ?s_city
}
}
Read query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select ?c_city ?s_city ?d_year sum(?rdfh_lo_revenue) as ?lo_revenue  

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels>  
from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted1> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted2> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted3> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted4> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted7> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted8> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted10> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted11> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted12> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted13>  

where {  

rdfh-inst:ds qb:slice ?slice.
?slice qb:observation ?obs; 
	rdfh:lo_partkey <http://lod2.eu/schemas/rdfh#lo_partkeyAllAll>;
	rdfh:lo_quantity <http://lod2.eu/schemas/rdfh#lo_quantityAllAll>;
	rdfh:lo_discount <http://lod2.eu/schemas/rdfh#lo_discountAllAll>.

?obs rdfh:lo_orderdate  ?d_year.  
rdfh:lo_orderdateYearLevel skos:member  ?d_year. 

?obs rdfh:lo_custkey ?c_city.
?c_nation skos:narrower  ?c_city.
rdfh:lo_custkeyNationLevel skos:member  ?c_nation.
 
?obs rdfh:lo_suppkey ?s_city.
?s_nation skos:narrower  ?s_city.
rdfh:lo_suppkeyNationLevel skos:member  ?s_nation.
  
?obs rdfh:lo_revenue ?rdfh_lo_revenue. 

FILTER(?c_nation = rdfh:lo_custkeyNationUNITED-STATES ).
FILTER(?s_nation = rdfh:lo_suppkeyNationUNITED-STATES ).
FILTER(str(?d_year) >= "http://lod2.eu/schemas/rdfh#lo_orderdateYear1992" and str(?d_year) <= "http://lod2.eu/schemas/rdfh#lo_orderdateYear1997").

} group by ?d_year ?c_city ?s_city order by asc(?d_year) desc(?lo_revenue) 

3.6.9 OLAP4LD-QB-M Q3.3 (9)

Create query is the same as for Q3.2. Read query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select ?c_city ?s_city ?d_year sum(?rdfh_lo_revenue) as ?lo_revenue  

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 
from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted1> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted2> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted3> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted4> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted7> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted8> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted10> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted11> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted12> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted13>

where {  

rdfh-inst:ds qb:slice ?slice.
?slice qb:observation ?obs; 
	rdfh:lo_partkey <http://lod2.eu/schemas/rdfh#lo_partkeyAllAll>;
	rdfh:lo_quantity <http://lod2.eu/schemas/rdfh#lo_quantityAllAll>;
	rdfh:lo_discount <http://lod2.eu/schemas/rdfh#lo_discountAllAll>.

?obs rdfh:lo_orderdate ?d_year.  
rdfh:lo_orderdateYearLevel skos:member  ?d_year. 

?obs rdfh:lo_custkey ?c_city.
rdfh:lo_custkeyCityLevel skos:member  ?c_city.
 
?obs rdfh:lo_suppkey ?s_city.
rdfh:lo_suppkeyCityLevel skos:member  ?s_city.
 
?obs rdfh:lo_revenue ?rdfh_lo_revenue. 

FILTER(?c_city = rdfh:lo_custkeyCityUNITED-KI1 OR ?c_city = rdfh:lo_custkeyCityUNITED-KI5).
FILTER(?s_city = rdfh:lo_suppkeyCityUNITED-KI1 OR ?s_city = rdfh:lo_suppkeyCityUNITED-KI5).
FILTER(str(?d_year) >= "http://lod2.eu/schemas/rdfh#lo_orderdateYear1992" and str(?d_year) <= "http://lod2.eu/schemas/rdfh#lo_orderdateYear1997").

} group by ?d_year ?c_city ?s_city order by asc(?d_year) desc(?lo_revenue) 

3.6.10 OLAP4LD-QB-M Q3.4 (10)

Create query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

INSERT INTO GRAPH <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted10> {

rdfh-inst:query10-aggview qb:observation _:obs.  
_:obs rdfh:lo_orderdate ?d_yearmonth.
_:obs rdfh:lo_custkey ?c_city.
_:obs rdfh:lo_partkey rdfh:lo_partkeyAllAll.
_:obs rdfh:lo_suppkey ?s_city.
_:obs rdfh:lo_quantity rdfh:lo_quantityAllAll. 
_:obs rdfh:lo_discount rdfh:lo_discountAllAll.
_:obs rdfh:lo_revenue ?lo_revenue. 

}

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 

where {  

{

select ?d_yearmonth ?c_city ?s_city sum(?rdfh_lo_revenue) as ?lo_revenue

where {  

?obs qb:dataSet rdfh-inst:ds. 
 
?obs rdfh:lo_orderdate  ?d_date. 
?d_date skos:narrower ?d_yearmonthnum.
?d_yearmonthnum skos:narrower ?d_yearmonth. 
?d_yearmonth skos:narrower ?d_year.  
?d_year skos:member rdfh:lo_orderdateYearLevel.

?obs rdfh:lo_custkey ?c_customer.
?c_customer skos:narrower ?c_city.
?c_city skos:member rdfh:lo_custkeyCityLevel.
 
?obs rdfh:lo_suppkey ?s_supplier.
?s_supplier skos:narrower ?s_city.
?s_city skos:member rdfh:lo_suppkeyCityLevel.
 
?obs rdfh:lo_revenue ?rdfh_lo_revenue. 

FILTER(?d_year = <http://lod2.eu/schemas/rdfh#lo_orderdateYear1998>).

} group by ?d_yearmonth ?c_city ?s_city  

}

} 
Read query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select ?c_city ?s_city ?d_year sum(?rdfh_lo_revenue) as ?lo_revenue  

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels>  
from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted1> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted2> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted3> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted4> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted7> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted8> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted10> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted11> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted12> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted13>  

where {  

rdfh-inst:ds qb:slice ?slice.
?slice qb:observation ?obs; 
	rdfh:lo_partkey <http://lod2.eu/schemas/rdfh#lo_partkeyAllAll>;
	rdfh:lo_quantity <http://lod2.eu/schemas/rdfh#lo_quantityAllAll>;
	rdfh:lo_discount <http://lod2.eu/schemas/rdfh#lo_discountAllAll>.

?obs rdfh:lo_orderdate ?d_yearmonth. 
?d_year skos:narrower  ?d_yearmonth.  
rdfh:lo_orderdateYearLevel skos:member  ?d_year. 

?obs rdfh:lo_custkey ?c_city.
rdfh:lo_custkeyCityLevel skos:member  ?c_city.
 
?obs rdfh:lo_suppkey ?s_city.
rdfh:lo_suppkeyCityLevel skos:member  ?s_city.

?obs rdfh:lo_revenue ?rdfh_lo_revenue. 

FILTER(?c_city = rdfh:lo_custkeyCityUNITED-KI1 OR ?c_city = rdfh:lo_custkeyCityUNITED-KI5).
FILTER(?s_city = rdfh:lo_suppkeyCityUNITED-KI1 OR ?s_city = rdfh:lo_suppkeyCityUNITED-KI5).
FILTER(?d_yearmonth = rdfh:lo_orderdateYearMonthDec1997).

} group by ?d_year ?c_city ?s_city order by asc(?d_year) desc(?lo_revenue) 


3.6.11 OLAP4LD-QB-M Q4.1 (11)

Create query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 


INSERT INTO GRAPH <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted11> {

rdfh-inst:query11-aggview qb:observation _:obs.  
_:obs rdfh:lo_orderdate ?d_year.
_:obs rdfh:lo_custkey ?c_nation.
_:obs rdfh:lo_partkey ?p_mfgr.
_:obs rdfh:lo_suppkey ?s_region.
_:obs rdfh:lo_quantity rdfh:lo_quantityAllAll. 
_:obs rdfh:lo_discount rdfh:lo_discountAllAll.
_:obs rdfh:sum_profit ?sum_profit. 

}
from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 
where {  

{

select ?d_year ?c_nation ?p_mfgr ?s_region sum(?lo_revenue - ?lo_supplycost) as ?sum_profit

where {

?obs qb:dataSet rdfh-inst:ds. 

?obs rdfh:lo_orderdate  ?d_date. 
?d_date skos:narrower ?d_yearmonthnum.
?d_yearmonthnum skos:narrower ?d_yearmonth. 
?d_yearmonth skos:narrower ?d_year.  
?d_year skos:member rdfh:lo_orderdateYearLevel. 

?obs rdfh:lo_custkey ?c_customer.
?c_customer skos:narrower ?c_city.
?c_city skos:narrower ?c_nation.
?c_nation skos:member rdfh:lo_custkeyNationLevel.

?obs rdfh:lo_partkey ?p_part.
?p_part skos:narrower ?p_brand1.
?p_brand1 skos:narrower ?p_category.
?p_category skos:narrower ?p_mfgr.
?p_mfgr skos:member rdfh:lo_partkeyMfgrLevel.

?obs rdfh:lo_suppkey ?s_supplier.
?s_supplier skos:narrower ?s_city.
?s_city skos:narrower ?s_nation.
?s_nation skos:narrower ?s_region.
?s_region skos:member rdfh:lo_suppkeyRegionLevel.

?obs rdfh:lo_revenue ?lo_revenue.
?obs rdfh:lo_supplycost ?lo_supplycost.  

} group by ?d_year ?c_nation ?p_mfgr ?s_region
}
}
Read query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select ?d_year ?c_nation sum(?rdfh_sum_profit) as ?sum_profit  

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 
from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted1> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted2> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted3> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted4> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted7> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted8> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted10> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted11> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted12> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted13> 

where {  

rdfh-inst:ds qb:slice ?slice.
?slice qb:observation ?obs; 
	rdfh:lo_quantity <http://lod2.eu/schemas/rdfh#lo_quantityAllAll>;
	rdfh:lo_discount <http://lod2.eu/schemas/rdfh#lo_discountAllAll>.

?obs rdfh:lo_orderdate ?d_year.  
rdfh:lo_orderdateYearLevel skos:member  ?d_year. 

?obs rdfh:lo_custkey ?c_nation.
?c_region skos:narrower  ?c_nation.
rdfh:lo_custkeyRegionLevel skos:member  ?c_region.

?obs rdfh:lo_partkey ?p_mfgr.
rdfh:lo_partkeyMfgrLevel skos:member  ?p_mfgr.
 
?obs rdfh:lo_suppkey ?s_region.
rdfh:lo_suppkeyRegionLevel skos:member  ?s_region.
 
?obs rdfh:sum_profit ?rdfh_sum_profit.

FILTER(?c_region = rdfh:lo_custkeyRegionAMERICA).
FILTER(?s_region = rdfh:lo_suppkeyRegionAMERICA).
FILTER (?p_mfgr = rdfh:lo_partkeyMfgrMFGR-1 OR ?p_mfgr = rdfh:lo_partkeyMfgrMFGR-2).

} group by ?d_year ?c_nation order by ?d_year ?c_nation  

3.6.12 OLAP4LD-QB-M Q4.2 (12)

Create query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 


INSERT INTO GRAPH <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted12> {

rdfh-inst:query12-aggview qb:observation _:obs.  
_:obs rdfh:lo_orderdate ?d_year.
_:obs rdfh:lo_custkey ?c_region.
_:obs rdfh:lo_partkey ?p_category.
_:obs rdfh:lo_suppkey ?s_nation.
_:obs rdfh:lo_quantity rdfh:lo_quantityAllAll. 
_:obs rdfh:lo_discount rdfh:lo_discountAllAll.
_:obs rdfh:sum_profit ?sum_profit. 

}
from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 
where {  

{

select ?d_year ?c_region ?p_category ?s_nation sum(?lo_revenue - ?lo_supplycost) as ?sum_profit

where {

?obs qb:dataSet rdfh-inst:ds. 

?obs rdfh:lo_orderdate  ?d_date. 
?d_date skos:narrower ?d_yearmonthnum.
?d_yearmonthnum skos:narrower ?d_yearmonth. 
?d_yearmonth skos:narrower ?d_year.  
?d_year skos:member rdfh:lo_orderdateYearLevel. 

?obs rdfh:lo_custkey ?c_customer.
?c_customer skos:narrower ?c_city.
?c_city skos:narrower ?c_nation.
?c_nation skos:narrower ?c_region.
?c_region skos:member rdfh:lo_custkeyRegionLevel.

?obs rdfh:lo_partkey ?p_part.
?p_part skos:narrower ?p_brand1.
?p_brand1 skos:narrower ?p_category.
?p_category skos:member rdfh:lo_partkeyCategoryLevel.

?obs rdfh:lo_suppkey ?s_supplier.
?s_supplier skos:narrower ?s_city.
?s_city skos:narrower ?s_nation.
?s_nation skos:member rdfh:lo_suppkeyNationLevel.

?obs rdfh:lo_revenue ?lo_revenue.
?obs rdfh:lo_supplycost ?lo_supplycost.  

} group by ?d_year ?c_region ?p_category ?s_nation
}
}
Read query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select ?d_year ?s_nation ?p_category sum(?rdfh_sum_profit) as ?sum_profit  

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels>  
from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted1> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted2> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted3> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted4> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted7> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted8> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted10> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted11> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted12> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted13> 

where {  

rdfh-inst:ds qb:slice ?slice.
?slice qb:observation ?obs; 
	rdfh:lo_quantity <http://lod2.eu/schemas/rdfh#lo_quantityAllAll>;
	rdfh:lo_discount <http://lod2.eu/schemas/rdfh#lo_discountAllAll>.
 
?obs rdfh:lo_orderdate ?d_year.  
rdfh:lo_orderdateYearLevel skos:member  ?d_year. 

?obs rdfh:lo_custkey ?c_region.
rdfh:lo_custkeyRegionLevel skos:member  ?c_region.

?obs rdfh:lo_partkey ?p_category.
?p_mfgr skos:narrower  ?p_category.
rdfh:lo_partkeyMfgrLevel skos:member  ?p_mfgr.
 
?obs rdfh:lo_suppkey ?s_nation.
?s_region skos:narrower  ?s_nation.
rdfh:lo_suppkeyRegionLevel skos:member  ?s_region.
 
?obs rdfh:sum_profit ?rdfh_sum_profit.  

FILTER(?d_year = rdfh:lo_orderdateYear1997 OR ?d_year = rdfh:lo_orderdateYear1998).
FILTER(?c_region = rdfh:lo_custkeyRegionAMERICA).
FILTER(?s_region = rdfh:lo_suppkeyRegionAMERICA).
FILTER (?p_mfgr = rdfh:lo_partkeyMfgrMFGR-1 OR ?p_mfgr = rdfh:lo_partkeyMfgrMFGR-2).

} group by ?d_year ?s_nation ?p_category order by ?d_year ?s_nation ?p_category  

3.6.13 OLAP4LD-QB-M Q4.3 (13)

Create query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 


INSERT INTO GRAPH <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted3> {

rdfh-inst:query13-aggview qb:observation _:obs.  
_:obs rdfh:lo_orderdate ?d_year.
_:obs rdfh:lo_custkey ?c_region.
_:obs rdfh:lo_partkey ?p_brand1.
_:obs rdfh:lo_suppkey ?s_city.
_:obs rdfh:lo_quantity rdfh:lo_quantityAllAll. 
_:obs rdfh:lo_discount rdfh:lo_discountAllAll.
_:obs rdfh:sum_profit ?sum_profit. 

}
from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb>  from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 
where {  

{

select ?d_year ?c_region ?p_brand1 ?s_city sum(?lo_revenue - ?lo_supplycost) as ?sum_profit

where {

?obs qb:dataSet rdfh-inst:ds. 

?obs rdfh:lo_orderdate  ?d_date. 
?d_date skos:narrower ?d_yearmonthnum.
?d_yearmonthnum skos:narrower ?d_yearmonth. 
?d_yearmonth skos:narrower ?d_year.  
?d_year skos:member rdfh:lo_orderdateYearLevel. 

?obs rdfh:lo_custkey ?c_customer.
?c_customer skos:narrower ?c_city.
?c_city skos:narrower ?c_nation.
?c_nation skos:narrower ?c_region.
?c_region skos:member rdfh:lo_custkeyRegionLevel.

?obs rdfh:lo_partkey ?p_part.
?p_part skos:narrower ?p_brand1.
?p_brand1 skos:member rdfh:lo_partkeyBrand1Level.

?obs rdfh:lo_suppkey ?s_supplier.
?s_supplier skos:narrower ?s_city.
?s_city skos:member rdfh:lo_suppkeyCityLevel.

?obs rdfh:lo_revenue ?lo_revenue.
?obs rdfh:lo_supplycost ?lo_supplycost.  

FILTER(?d_year = rdfh:lo_orderdateYear1992).
} group by ?d_year ?c_region ?p_brand1 ?s_city
}
}
Read query:
PREFIX dc: <http://purl.org/dc/elements/1.1/> 
PREFIX sdmx-measure: <http://purl.org/linked-data/sdmx/2009/measure#> 
PREFIX qb: <http://purl.org/linked-data/cube#> 
PREFIX refgovukyear: <http://reference.data.gov.uk/id/year/> 
PREFIX refgovukmonth: <http://reference.data.gov.uk/id/month/> 
PREFIX dcterms: <http://purl.org/dc/terms/> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 
PREFIX skosclass: <http://ddialliance.org/ontologies/skosclass#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#> 
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX rdfh: <http://lod2.eu/schemas/rdfh#> 
PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 
PREFIX refgovukday: <http://reference.data.gov.uk/id/day/> 
PREFIX rdfh-inst: <http://lod2.eu/schemas/rdfh-inst#> 

select ?d_year ?s_city ?p_brand1 sum(?rdfh_sum_profit) as ?sum_profit  

from <http://lod2.eu/schemas/rdfh-inst#ssb1_ttl_qb> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_dsd> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_levels> 
from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted1> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted2> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted3> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted4> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted7> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted8> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted10> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted11> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted12> from <http://lod2.eu/schemas/rdfh#ssb1_ttl_aggviews_inserted13> 

where {  

rdfh-inst:ds qb:slice ?slice.
?slice qb:observation ?obs; 
	rdfh:lo_quantity <http://lod2.eu/schemas/rdfh#lo_quantityAllAll>;
	rdfh:lo_discount <http://lod2.eu/schemas/rdfh#lo_discountAllAll>.

?obs rdfh:lo_orderdate  ?d_year.  
rdfh:lo_orderdateYearLevel skos:member  ?d_year. 

?obs rdfh:lo_custkey ?c_region.
rdfh:lo_custkeyRegionLevel skos:member  ?c_region. 

?obs rdfh:lo_partkey ?p_brand1.
?p_category skos:narrower  ?p_brand1.
rdfh:lo_partkeyCategoryLevel skos:member  ?p_category.
 
?obs rdfh:lo_suppkey ?s_city.
?s_nation skos:narrower  ?s_city.
rdfh:lo_suppkeyNationLevel skos:member  ?s_nation.
 
?obs rdfh:sum_profit ?rdfh_sum_profit.

FILTER(?d_year = rdfh:lo_orderdateYear1997 OR ?d_year = rdfh:lo_orderdateYear1998).
FILTER(?c_region = rdfh:lo_custkeyRegionAMERICA).
FILTER (?p_category = rdfh:lo_partkeyCategoryMFGR-14 ).
FILTER(?s_nation = rdfh:lo_suppkeyNationUNITED-STATES).

} group by ?d_year ?s_city ?p_brand1 order by ?d_year ?s_city ?p_brand1  

4. Results

The following table lists the results per query:
Table: Evaluation results with single and total elapsed query time (in sec) per approach
Name Q1.1 Q1.2 Q1.3 Q2.1 Q2.2 Q2.3 Q3.1 Q3.2 Q3.3 Q3.4 Q4.1 Q4.2 Q4.3 Total
RDBMS 1.6 1.1 1.1 16.1 15.7 15.4 10.4 7.8 7.6 3.1 11.0 5.3 5.0 101
ROLAP 1.7 1.1 1.1 15.3 14.7 14.5 10.4 7.6 7.0 3.0 11.0 5.1 4.8 97
ROLAP-M 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.6 0.1 0.1 0.8 2
OLAP4LD-SSB 22.5 0.8 0.2 16.1 0.9 0.2 28.5 2.1 1.0 0.4 N/A* 36.8 9.6 119
OLAP4LD-QB 46.1 1.3 0.2 55.0 49.4 31.1 145.7 12.5 1.8 87.2 175.3 544.5 24.9 1,175
OLAP4LD-QB-M 19.9 10.2 10.2 366.3 356.7 356.3 468.5 467.6 4.6 4.6 0.1 0.4 55.4 2,121
*: Q4.1 is not included since it does not successfully complete.

The following figure illustrates the difference in modelling between the non-materialising approaches RDBMS/ROLAP, OLAP4LD-SSB and OLAP4LD-QB:

SSB Modelling
Figure: Comparison of SSB modelling

A. Prefixes Used in this Document

Table: Overview of used prefixes
Prefix Namespace URI Vocabulary Description
qb http://purl.org/linked-data/cube# The RDF Data Cube Vocabulary
skos http://www.w3.org/2004/02/skos/core# Simple Knowledge Organization System
xkos http://purl.org/linked-data/xkos# SKOS Extension for Statistics Replacing skosclass.
skosclass http://ddialliance.org/ontologies/skosclass# SKOS extension for the representation of classifications Deprecated. Replaced by xkos.
rdfh http://lod2.eu/schemas/rdfh# BIBM RDF Vocabulary (Schema) Simple RDF vocabulary for tabular data.
rdfh-inst http://lod2.eu/schemas/rdfh-inst# BIBM RDF Vocabulary (Instances) Simple RDF vocabulary for tabular data.
rdf http://www.w3.org/1999/02/22-rdf-syntax-ns# RDF Core
rdfs http://www.w3.org/2000/01/rdf-schema# RDF Schema
dc http://purl.org/dc/elements/1.1/ Dublin Core

B. Acknowledgements

This work is supported by the Deutsche Forschungsgemeinschaft (DFG) under the SFB/TRR 125 - Cognition-Guided Surgery and under the Software-Campus project. We thank Günter Ladwig, Andreas Wagner and the anonymous reviewers for helpful support and feedback.

C. References

[KRH2012]
Benedikt Kämpgen, Sean O’Riain, and Andreas Harth. Interacting with Statistical Linked Data via OLAP Operations. ESWC 2012 Workshop Highlights, Lecture Notes in Computer Science (LNCS), Springer Verlag, 2012 (in press). (Extended Paper published in Conf. Proceedings.) (pdf)
[SSB2009]
O’Neil, P., O’Neil, E., Chen, X.: Star Schema Benchmark - Revision 3. Tech. rep., UMass/Boston (2009), http://www.cs.umb.edu/~poneil/StarSchemaB.pdf

C.1 Normative references

No normative references.

C.2 Informative references

No informative references.