Skip to main content

Phase 2- Knowledge implementation work

In this section we will walk you through the process of building your ontology and mapping files and testing them. We will explain the process of building the Ontology and Mapping files using two sample data files customers.csv and orders.csv. We recommend that you follow along the example by using these files. After you have understood the concepts, you can build the Ontologies and Mappings using your own virtualized data.

Create a project and dataset for your training data

  1. Add the ddw-standard-catalog-index.ttl file provided by data.world to the ddw-catalogs dataset. No edits should me made to this file.

    aice_train_dataset_indexfile.png
  2. Create a dataset, training-dataset and add the customers.csv and orders.csv files to it.

    aice_train_dataset.png
  3. Create a Project, training-project and add the Index file, template Ontology file and template Mapping file to it and link the project with the training-dataset dataset. No edits should me made to the ddw-standard-index.ttl file.

    aice_train_project.png
  4. You can copy the following syntax to get started with these files.

    Template for Ontology file

    @prefix owl: <http://www.w3.org/2002/07/owl#> .
    @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
    @prefix model: <https://YourCompany.app.data.world/schema/> .
    
    
    
    ## CONCEPT 1
    
    model:ConceptID rdf:type owl:Class ; #For example, model:Customer
        rdfs:label "Concept label" ;
        rdfs:comment "A description of concept" ;
    .
    
    
    ## ATTRIBUTES FOR CONCEPT
    
    model:AttributeID rdf:type owl:DatatypeProperty ;
         rdfs:label "Attribute label" ;
         rdfs:comment "Description of attribute." ;
         rdfs:domain model:AssociatedconceptID ;
    .
    
    
    ## RELATIONSHIPS FOR CONCEPT 1
    
    model:RelationshipID rdf:type owl:ObjectProperty ; #For example, model:CustomerHasPlacedOrder
        rdfs:label "Relationship Label" ;
        rdfs:comment "Description of relationship" ;
        rdfs:domain model:ForConceptID ; #Continuing the example, model:Customer
        rdfs:range model:ToConceptID ; #Continuing the example, model:Order
    .
    
    ## CONCEPT 2
    
    model:Order rdf:type owl:Class ;
        rdfs:label "Order" ;
        rdfs:comment "An order transaction for our business" ;
    .
    
    ## ATTRIBUTES FOR CONCEPT2
    
    model:AttributeID rdf:type owl:DatatypeProperty ;
         rdfs:label "Attribute label" ;
         rdfs:comment "Description of attribute." ;
         rdfs:domain model:AssociatedConceptID ;
    .
    
    
    ## RELATIONSHIPS FOR CONCEPT 2
    
    model:RelationshipID rdf:type owl:ObjectProperty ; #For example, model:CustomerHasPlacedOrder
        rdfs:label "Relationship Label" ;
        rdfs:comment "Description of relationship" ;
        rdfs:domain model:ForConceptID ; #Continuing the example, model:Customer
        rdfs:range model:ToConceptID ; #Continuing the example, model:Order
    .

    Template for mapping file

    @prefix rr:  <http://www.w3.org/ns/r2rml#> .
    @prefix map:  <https://YourCompany.app.data.world/mapping/> .
    @prefix model: <https://YourCompany.app.data.world/schema/> .
    
    
    
    map:CHANGEMEConceptMapping a rr:TriplesMap ;
    ##Mapping for CONCEPT
        rr:logicalTable        [ rr:tableName "FILLME" #table or view name that is bieng mapped to the concept. This could also be a SQL query.
    
        ] ;
    
    
        rr:subjectMap          [ 
            rr:class model:IDofConcept; #ID of the concept we are mapping to
            rr:template "FILLME" #URI scheme that uniquely identifies each instance of the concept. It will use columns that uniquely identify the instance. FOr example, https://yourcomapnyname.app.data.world/d/Customer-{customerID}
        ] ;
    
    
    
        ## Mapping for ATTRIBUTES that uses the data in the table name above.
        rr:predicateObjectMap   [ 
            rr:predicate model:AttributeID; #ID of the Attribute we are mapping to. 
            rr:objectMap [ rr:column "FILLME" ] ; #column name that is in the table name for which is being mapped
        ] ;
        
    
        ## Mapping for RELATIONSHIPS that uses the data in the table name above. 
        rr:predicateObjectMap   [ 
            rr:predicate model:RelationshipID;
            rr:objectMap [ 
                rr:template "FILLME" #template of the To Concept ID. For example, https://model.app.data.world/d/Order-{order_uid}
            ] ;
        ] ;
        
    .

Build the ontology and mapping for the first concept

  1. Let us now look at the sample customer.csv file to understand the data we will use for building the ontology and mapping files. This file contains a Customers table and it has 10 columns in it.

    sample_customer_file.png
  2. Now, let us add the customer concept and nine attributes for the nine columns in the table to the Ontology file. Note we are skipping one column in the table as it is empty.

    aice_train_ontology_sample.png
    • First replace, YourCompany, with the name of your data.world instance.

    • For the customer concept, define the concept name, label, and a comment.

    • For the 9 columns in the table, add the corresponding attributes. For each attribute define the attribute name, label, the comment, and the concept it maps to.

    @prefix owl: <http://www.w3.org/2002/07/owl#> .
    @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
    @prefix model: <https://YourCompany.app.data.world/schema/> .
    
    
    
    ## CUSTOMER CONCEPT
    
    model:Customer rdf:type owl:Class ; #For example, model:Customer
        rdfs:label "Customer" ;
        rdfs:comment "This is a customer who bought something from our business" ;
    .
    
    
    ## ATTRIBUTES FOR CUSTOMER CONCEPT
    
    model:CustomerID rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
         rdfs:label "Customer ID" ;
         rdfs:comment "This is the unique identifier for the customer." ;
         rdfs:domain model:Customer ; #Continuing the example, model:Customer
    .
    model:Login rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
         rdfs:label "Login" ;
         rdfs:comment "This is the username the customer uses to log in to our site." ;
         rdfs:domain model:Customer ; #Continuing the example, model:Customer
    .
    model:FirstName rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
         rdfs:label "First Name" ;
         rdfs:comment "The first name of the customer." ;
         rdfs:domain model:Customer ; #Continuing the example, model:Customer
    .
    model:LastName rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
         rdfs:label "Last Name" ;
         rdfs:comment "The last name of the customer." ;
         rdfs:domain model:Customer ; #Continuing the example, model:Customer
    .
    model:Address rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
         rdfs:label "Address" ;
         rdfs:comment "The address for the customer." ;
         rdfs:domain model:Customer ; #Continuing the example, model:Customer
    .
    model:City rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
         rdfs:label "City" ;
         rdfs:comment "The city for the customer." ;
         rdfs:domain model:Customer ; #Continuing the example, model:Customer
    .
    model:State rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
         rdfs:label "State" ;
         rdfs:comment "The state for the customer." ;
         rdfs:domain model:Customer ; #Continuing the example, model:Customer
    .
    model:PostalCode rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
         rdfs:label "Postal Code" ;
         rdfs:comment "The postal zip code for the customer." ;
         rdfs:domain model:Customer ; #Continuing the example, model:Customer
    .
    model:Country rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
         rdfs:label "Country" ;
         rdfs:comment "The country for the customer." ;
         rdfs:domain model:Customer ; #Continuing the example, model:Customer
    .
  3. Next, let us create the Mapping file for the Customer concept and its attributes.

    aice_train_mapping_sample.png
    • First, replace the three occurrences of, YourCompany, with the name of your data.world instance.

    • Create a mapping for the concept Customer to the table customers.

    • Next, create mapping for the 9 columns in the table to the nine attributes you defined in the Ontology file.

    @prefix rr:  <http://www.w3.org/ns/r2rml#> .
    @prefix map:  <https://YourCompany.app.data.world/mapping/> .
    @prefix model: <https://YourCompany.app.data.world/schema/> .
    
    
    map:CustomerMapping a rr:TriplesMap ;
    
        ## Mapping for CONCEPT
        rr:logicalTable [ 
            rr:tableName "customers" #table or view name that is being mapped to the Concept. This could also be a SQL query (more later)
        ] ;
    
        rr:subjectMap   [ 
            rr:class model:Customer ; #ID of the Concept we are mapping to. 
            rr:template "https://YourCompany.app.data.world/d/Customer-{cust_customerid}" # URI scheme that uniquely identifies each instance of the Concept. It will use columns that uniquely identify the instance e.g. https://yourcompany.app.data.world/d/Customer-{customerid} 
        ] ;
    
    
        ## Mappings for ATTRIBUTES that use the data in the table name above. 
        rr:predicateObjectMap   [ 
            rr:predicate model:CustomerID ; #ID of the Attribute we are mapping to. 
            rr:objectMap [ rr:column "cust_customerid" ] ; #column name that is in the table name for which is being mapped
        ] ;
        rr:predicateObjectMap   [ 
            rr:predicate model:Login ; #ID of the Attribute we are mapping to. 
            rr:objectMap [ rr:column "cust_login" ] ; #column name that is in the table name for which is being mapped
        ] ;
        rr:predicateObjectMap   [ 
            rr:predicate model:FirstName ; #ID of the Attribute we are mapping to. 
            rr:objectMap [ rr:column "cust_firstname" ] ; #column name that is in the table name for which is being mapped
        ] ;
        rr:predicateObjectMap   [ 
            rr:predicate model:LastName ; #ID of the Attribute we are mapping to. 
            rr:objectMap [ rr:column "cust_lastname" ] ; #column name that is in the table name for which is being mapped
        ] ;
        rr:predicateObjectMap   [ 
            rr:predicate model:Address ; #ID of the Attribute we are mapping to. 
            rr:objectMap [ rr:column "cust_address1" ] ; #column name that is in the table name for which is being mapped
        ] ;
        rr:predicateObjectMap   [ 
            rr:predicate model:City ; #ID of the Attribute we are mapping to. 
            rr:objectMap [ rr:column "cust_city" ] ; #column name that is in the table name for which is being mapped
        ] ;
        rr:predicateObjectMap   [ 
            rr:predicate model:State ; #ID of the Attribute we are mapping to. 
            rr:objectMap [ rr:column "cust_state" ] ; #column name that is in the table name for which is being mapped
        ] ;
        rr:predicateObjectMap   [ 
            rr:predicate model:PostalCode ; #ID of the Attribute we are mapping to. 
            rr:objectMap [ rr:column "cust_postalcode" ] ; #column name that is in the table name for which is being mapped
        ] ;
        rr:predicateObjectMap   [ 
            rr:predicate model:Country ; #ID of the Attribute we are mapping to. 
            rr:objectMap [ rr:column "cust_country" ] ; #column name that is in the table name for which is being mapped
        ] ;
    .
  4. Add both the files to the training-project project.

  5. Next, test your training data using the Developer Tool provided by data.world. The link of the tool looks like. https://yourcompany.app.data.world/a/demo/yourorg/yourproject/chat/new

    You can ask questions like: How many customers do I have? Do you have customers in Texas or Ohio?

    For the second question, Do you have customers in Texas or Ohio?, you will notice that the tool will not return any results as the abbreviated names of the states are used in the table. If you go back to Step 6 and update the comment of the state to say The state for the customer, using the two letter abbreviation for state, such as AL or AK for example and run the tool with the updated file, it will be able to correctly answer the question Do you have customers in Texas or Ohio?

Build the ontology and mapping for the second concept

  1. Next, let us extend the Semantic Model by building out the concept and attributes for Orders.

    ## ORDER CONCEPT
    
    model:Order rdf:type owl:Class ; #For example, model:Customer
        rdfs:label "Order" ;
        rdfs:comment "This is a order purchase made by a customer" ;
    .
    
    ## ATTRIBUTES FOR ORDER CONCEPT
    
    model:OrderID rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
         rdfs:label "Order ID" ;
         rdfs:comment "This is the unique identifier for the order purchase." ;
         rdfs:domain model:Order ; #Continuing the example, model:Customer
    .
    model:CustomerID rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
         rdfs:label "Customer ID" ;
         rdfs:comment "This is the unique identifier for the customer." ;
         rdfs:domain model:Order ; #Continuing the example, model:Customer
    .
    model:Date rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
         rdfs:label "Date" ;
         rdfs:comment "This is the date in which the order purchase occurred." ;
         rdfs:domain model:Order ; #Continuing the example, model:Customer
    .
    model:Tax rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
         rdfs:label "Tax" ;
         rdfs:comment "This is the amount of tax paid by the customer as part of the order." ;
         rdfs:domain model:Order ; #Continuing the example, model:Customer
    .
    model:Shipping rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
         rdfs:label "Shipping" ;
         rdfs:comment "This is the amount of shipping fee paid by the customer as part of the order." ;
         rdfs:domain model:Order ; #Continuing the example, model:Customer
    .
    model:Merchandise rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
         rdfs:label "Merchandise" ;
         rdfs:comment "This is the merchandise fee, in other words the cost of the products, paid by the customer as part of the order." ;
         rdfs:domain model:Order ; #Continuing the example, model:Customer
    .
  2. Let us add the mapping now the new concept, Orders and its attributes.

    map:OrderMapping a rr:TriplesMap ;
    
        ## Mapping for CONCEPT
        rr:logicalTable [ 
            rr:tableName "orders" #table or view name that is being mapped to the Concept. This could also be a SQL query (more later)
        ] ;
    
        rr:subjectMap   [ 
            rr:class model:Order ; #ID of the Concept we are mapping to. 
            rr:template "https://YourCompany.app.data.world/d/Order-{orderid}" # URI scheme that uniquely identifies each instance of the Concept. It will use columns that uniquely identify the instance e.g. https://yourcompany.app.data.world/d/Customer-{customerid} 
        ] ;
    
    
        ## Mappings for ATTRIBUTES that use the data in the table name above. 
        rr:predicateObjectMap   [ 
            rr:predicate model:OrderID ; #ID of the Attribute we are mapping to. 
            rr:objectMap [ rr:column "orderid" ] ; #column name that is in the table name for which is being mapped
        ] ;
        rr:predicateObjectMap   [ 
            rr:predicate model:CustomerID ; #ID of the Attribute we are mapping to. 
            rr:objectMap [ rr:column "customerid" ] ; #column name that is in the table name for which is being mapped
        ] ;
        rr:predicateObjectMap   [ 
            rr:predicate model:Date ; #ID of the Attribute we are mapping to. 
            rr:objectMap [ rr:column "date" ] ; #column name that is in the table name for which is being mapped
        ] ;
        rr:predicateObjectMap   [ 
            rr:predicate model:Tax ; #ID of the Attribute we are mapping to. 
            rr:objectMap [ rr:column "tax" ] ; #column name that is in the table name for which is being mapped
        ] ;
        rr:predicateObjectMap   [ 
            rr:predicate model:Shipping ; #ID of the Attribute we are mapping to. 
            rr:objectMap [ rr:column "shipping" ] ; #column name that is in the table name for which is being mapped
        ] ;
        rr:predicateObjectMap   [ 
            rr:predicate model:Merchandise ; #ID of the Attribute we are mapping to. 
            rr:objectMap [ rr:column "merchandise" ] ; #column name that is in the table name for which is being mapped
        ] ;
    
    .
  3. Add both the updated files to the training-project project.

  4. Next, test the new concept and mapping by asking questions like: How many orders are there? What is the average tax for all orders?

  5. Next, let us ask a little complicated question like What is the name of the customer with the highest merchandise fee? You will notice that you will not be able to get an answer to this question as the two concepts are not related yet.

Build a relationship between the two concepts

  1. Add the following relationship to the Ontology file. While creating relationships, direction matters, so pay special attention to that.

    ## RELATIONSHIPS FOR ORDER CONCEPT
    
    model:OrderPlacedByCustomer rdf:type owl:ObjectProperty ; #For example, model:CustomerHasPlacedOrder
        rdfs:label "Order Placed By Customer" ;
        rdfs:comment "The order purchase is placed by a customer" ;
        rdfs:domain model:Order ; #Continuing the example, model:Customer
        rdfs:range model:Customer ; #Continuing the example, model:Order
    .
  2. Add the following relationship to the mapping file.

       ## Mappings for RELATIONSHIPS that use the data in the table name above. 
        rr:predicateObjectMap   [ 
            rr:predicate model:OrderPlacedByCustomer ;
            rr:objectMap [ 
                rr:template "https://YourCompany.app.data.world/d/Customer-{customerid}" #template of the To Concept ID e.g. https://yourcompany.app.data.world/d/Customer-{customerid} 
            ] ; 
        ] ;
    
  3. Add the updated files to the training-project project.

  4. Now, ask the question What is the name of the customer with the highest merchandise fee? again and you should get the relevant results.

  5. You can now further test the data using questions like . What is the average tax in Texas versus in Ohio? Ontology used. What is the name of the person that made the most to. Orders? What are the 10 most expensive orders in terms of total cost and the names of the customers that made them.

You can also download the complete syntax of the Ontology file using this link. Make sure to update all occurrences of YourCompany with the name of your data.world instance name.

@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix model: <https://YourCompany.app.data.world/schema/> .



## CUSTOMER CONCEPT

model:Customer rdf:type owl:Class ; #For example, model:Customer
    rdfs:label "Customer" ;
    rdfs:comment "This is a customer who bought something from our business" ;
.


## ATTRIBUTES FOR CUSTOMER CONCEPT

model:CustomerID rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
     rdfs:label "Customer ID" ;
     rdfs:comment "This is the unique identifier for the customer." ;
     rdfs:domain model:Customer ; #Continuing the example, model:Customer
.
model:Login rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
     rdfs:label "Login" ;
     rdfs:comment "This is the username the customer uses to log in to our site." ;
     rdfs:domain model:Customer ; #Continuing the example, model:Customer
.
model:FirstName rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
     rdfs:label "First Name" ;
     rdfs:comment "The first name of the customer." ;
     rdfs:domain model:Customer ; #Continuing the example, model:Customer
.
model:LastName rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
     rdfs:label "Last Name" ;
     rdfs:comment "The last name of the customer." ;
     rdfs:domain model:Customer ; #Continuing the example, model:Customer
.
model:Address rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
     rdfs:label "Address" ;
     rdfs:comment "The address for the customer." ;
     rdfs:domain model:Customer ; #Continuing the example, model:Customer
.
model:City rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
     rdfs:label "City" ;
     rdfs:comment "The city for the customer." ;
     rdfs:domain model:Customer ; #Continuing the example, model:Customer
.
model:State rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
     rdfs:label "State" ;
     rdfs:comment "The state for the customer, using the two letter abbreviation for state, such as AL or AK for example." ;
     rdfs:domain model:Customer ; #Continuing the example, model:Customer
.
model:PostalCode rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
     rdfs:label "Postal Code" ;
     rdfs:comment "The postal zip code for the customer." ;
     rdfs:domain model:Customer ; #Continuing the example, model:Customer
.
model:Country rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
     rdfs:label "Country" ;
     rdfs:comment "The country for the customer." ;
     rdfs:domain model:Customer ; #Continuing the example, model:Customer
.

## ORDER CONCEPT

model:Order rdf:type owl:Class ; #For example, model:Customer
    rdfs:label "Order" ;
    rdfs:comment "This is a order purchase made by a customer" ;
.

## ATTRIBUTES FOR ORDER CONCEPT

model:OrderID rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
     rdfs:label "Order ID" ;
     rdfs:comment "This is the unique identifier for the order purchase." ;
     rdfs:domain model:Order ; #Continuing the example, model:Customer
.
model:CustomerID rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
     rdfs:label "Customer ID" ;
     rdfs:comment "This is the unique identifier for the customer." ;
     rdfs:domain model:Order ; #Continuing the example, model:Customer
.
model:Date rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
     rdfs:label "Date" ;
     rdfs:comment "This is the date in which the order purchase occurred." ;
     rdfs:domain model:Order ; #Continuing the example, model:Customer
.
model:Tax rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
     rdfs:label "Tax" ;
     rdfs:comment "This is the amount of tax paid by the customer as part of the order." ;
     rdfs:domain model:Order ; #Continuing the example, model:Customer
.
model:Shipping rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
     rdfs:label "Shipping" ;
     rdfs:comment "This is the amount of shipping fee paid by the customer as part of the order." ;
     rdfs:domain model:Order ; #Continuing the example, model:Customer
.
model:Merchandise rdf:type owl:DatatypeProperty ; #For example, model:CustomerID
     rdfs:label "Merchandise" ;
     rdfs:comment "This is the merchandise fee, in other words the cost of the products, paid by the customer as part of the order." ;
     rdfs:domain model:Order ; #Continuing the example, model:Customer
.

## RELATIONSHIPS FOR ORDER CONCEPT

model:OrderPlacedByCustomer rdf:type owl:ObjectProperty ; #For example, model:CustomerHasPlacedOrder
    rdfs:label "Order Placed By Customer" ;
    rdfs:comment "The order purchase is placed by a customer" ;
    rdfs:domain model:Order ; #Continuing the example, model:Customer
    rdfs:range model:Customer ; #Continuing the example, model:Order
.

You can also download the complete syntax of the Mapping file using this link. Make sure to update all occurrences of YourCompany with the name of your data.world instance name.

@prefix rr:  <http://www.w3.org/ns/r2rml#> .
@prefix map:  <https://YourCompany.app.data.world/mapping/> .
@prefix model: <https://YourCompany.app.data.world/schema/> .


map:CustomerMapping a rr:TriplesMap ;

    ## Mapping for CONCEPT
    rr:logicalTable [ 
        rr:tableName "customers" #table or view name that is being mapped to the Concept. This could also be a SQL query (more later)
    ] ;

    rr:subjectMap   [ 
        rr:class model:Customer ; #ID of the Concept we are mapping to. 
        rr:template "https://YourCompany.app.data.world/d/Customer-{cust_customerid}" # URI scheme that uniquely identifies each instance of the Concept. It will use columns that uniquely identify the instance e.g. https://yourcompany.app.data.world/d/Customer-{customerid} 
    ] ;


    ## Mappings for ATTRIBUTES that use the data in the table name above. 
    rr:predicateObjectMap   [ 
        rr:predicate model:CustomerID ; #ID of the Attribute we are mapping to. 
        rr:objectMap [ rr:column "cust_customerid" ] ; #column name that is in the table name for which is being mapped
    ] ;
    rr:predicateObjectMap   [ 
        rr:predicate model:Login ; #ID of the Attribute we are mapping to. 
        rr:objectMap [ rr:column "cust_login" ] ; #column name that is in the table name for which is being mapped
    ] ;
    rr:predicateObjectMap   [ 
        rr:predicate model:FirstName ; #ID of the Attribute we are mapping to. 
        rr:objectMap [ rr:column "cust_firstname" ] ; #column name that is in the table name for which is being mapped
    ] ;
    rr:predicateObjectMap   [ 
        rr:predicate model:LastName ; #ID of the Attribute we are mapping to. 
        rr:objectMap [ rr:column "cust_lastname" ] ; #column name that is in the table name for which is being mapped
    ] ;
    rr:predicateObjectMap   [ 
        rr:predicate model:Address ; #ID of the Attribute we are mapping to. 
        rr:objectMap [ rr:column "cust_address1" ] ; #column name that is in the table name for which is being mapped
    ] ;
    rr:predicateObjectMap   [ 
        rr:predicate model:City ; #ID of the Attribute we are mapping to. 
        rr:objectMap [ rr:column "cust_city" ] ; #column name that is in the table name for which is being mapped
    ] ;
    rr:predicateObjectMap   [ 
        rr:predicate model:State ; #ID of the Attribute we are mapping to. 
        rr:objectMap [ rr:column "cust_state" ] ; #column name that is in the table name for which is being mapped
    ] ;
    rr:predicateObjectMap   [ 
        rr:predicate model:PostalCode ; #ID of the Attribute we are mapping to. 
        rr:objectMap [ rr:column "cust_postalcode" ] ; #column name that is in the table name for which is being mapped
    ] ;
    rr:predicateObjectMap   [ 
        rr:predicate model:Country ; #ID of the Attribute we are mapping to. 
        rr:objectMap [ rr:column "cust_country" ] ; #column name that is in the table name for which is being mapped
    ] ;


    ## Mappings for RELATIONSHIPS that use the data in the table name above. 
    #rr:predicateObjectMap   [ 
    #    rr:predicate model:RelationshipID ;
    #    rr:objectMap [ 
    #        rr:template "FILLME" #template of the To Concept ID e.g. https://yourcompany.app.data.world/d/Customer-{customerid} 
    #    ] ; 
    #] ;

.

map:OrderMapping a rr:TriplesMap ;

    ## Mapping for CONCEPT
    rr:logicalTable [ 
        rr:tableName "orders" #table or view name that is being mapped to the Concept. This could also be a SQL query (more later)
    ] ;

    rr:subjectMap   [ 
        rr:class model:Order ; #ID of the Concept we are mapping to. 
        rr:template "https://YourCompany.app.data.world/d/Order-{orderid}" # URI scheme that uniquely identifies each instance of the Concept. It will use columns that uniquely identify the instance e.g. https://yourcompany.app.data.world/d/Customer-{customerid} 
    ] ;


    ## Mappings for ATTRIBUTES that use the data in the table name above. 
    rr:predicateObjectMap   [ 
        rr:predicate model:OrderID ; #ID of the Attribute we are mapping to. 
        rr:objectMap [ rr:column "orderid" ] ; #column name that is in the table name for which is being mapped
    ] ;
    rr:predicateObjectMap   [ 
        rr:predicate model:CustomerID ; #ID of the Attribute we are mapping to. 
        rr:objectMap [ rr:column "customerid" ] ; #column name that is in the table name for which is being mapped
    ] ;
    rr:predicateObjectMap   [ 
        rr:predicate model:Date ; #ID of the Attribute we are mapping to. 
        rr:objectMap [ rr:column "date" ] ; #column name that is in the table name for which is being mapped
    ] ;
    rr:predicateObjectMap   [ 
        rr:predicate model:Tax ; #ID of the Attribute we are mapping to. 
        rr:objectMap [ rr:column "tax" ] ; #column name that is in the table name for which is being mapped
    ] ;
    rr:predicateObjectMap   [ 
        rr:predicate model:Shipping ; #ID of the Attribute we are mapping to. 
        rr:objectMap [ rr:column "shipping" ] ; #column name that is in the table name for which is being mapped
    ] ;
    rr:predicateObjectMap   [ 
        rr:predicate model:Merchandise ; #ID of the Attribute we are mapping to. 
        rr:objectMap [ rr:column "merchandise" ] ; #column name that is in the table name for which is being mapped
    ] ;


    ## Mappings for RELATIONSHIPS that use the data in the table name above. 
    rr:predicateObjectMap   [ 
        rr:predicate model:OrderPlacedByCustomer ;
        rr:objectMap [ 
            rr:template "https://YourCompany.app.data.world/d/Customer-{customerid}" #template of the To Concept ID e.g. https://yourcompany.app.data.world/d/Customer-{customerid} 
        ] ; 
    ] ;

.