AdventureWorks is a famous sample database published by Microsoft. This project maps its 2019 OLTP edition installed on SQL Server 15.00.4236.
- Persons
- Products
- Offers
- Orders
- Reviews
It uses the schema.org vocabulary as much as possible. What has been added are categories for products and sales reasons, which can be considered as internal data and are outside the scope of schema.org.
- Create a project on Ontopic Studio
- Configure the connection to the SQL Server instance on which AdventureWorks is installed
- On the dashboard, click on "Import project" and load the file
adventureworks-sqlserver.ontopicprj
- Go to "Search" and get an overview of what has been mapped
- Go "Query > SPARQL" and test your SPARQL queries
SELECT DISTINCT ?c ?p WHERE {
?sub a ?c ; ?p ?o .
}
GROUP BY ?c ?p
ORDER BY ?c ?p
PREFIX schema: <http://schema.org/>
SELECT ?year (SUM(?totalDue) AS ?totalSales) ?firstName ?lastName WHERE {
?order a schema:Order ;
schema:partOfInvoice / schema:totalPaymentDue / schema:value ?totalDue ;
schema:broker ?salesPerson ;
schema:orderDate ?date .
?salesPerson schema:familyName ?lastName ; schema:givenName ?firstName .
BIND (year(?date) AS ?year)
}
GROUP BY ?year ?firstName ?lastName
ORDER BY ?year DESC(?totalSales)
PREFIX schema: <http://schema.org/>
SELECT ?productNumber ?year (SUM(?price) AS ?productSales) WHERE {
?order a schema:Order ;
schema:orderedItem ?orderItem ;
schema:orderDate ?date .
?orderItem schema:price ?price;
schema:orderedItem ?product.
?product schema:sku ?productNumber .
BIND (year(?date) AS ?year)
}
GROUP BY ?productNumber ?year
ORDER BY ?year DESC(?productSales)
- Edit the file
adventure.properties
to insert the credentials and the JDBC URL for connecting to the database. Tip: you can see the URL in Ontopic Studio. - Start the docker-compose script:
docker-compose up -d
- Open http://localhost:8080 and run your SPARQL queries
- Edit the file
adventure.properties
to insert the credentials and the JDBC URL for connecting to the database. - Make sure every user can write in the directory
output
. On Unix:chmod 777 output
- Run the docker-compose script for materialization:
docker-compose -f docker-compose-materialization.yml up
- Wait for the command to finish. You should find the file
kg.nt
in theoutput
directory.
We commented out the ontology parameter to avoid materializing the saturated graph (i.e. the graph obtained after reasoning). Remove the comment if you want to obtain the saturated graph.