Data
Import CSV data using SPARQL mappings
Northwind's data ships as plain CSV files. LinkedDataHub imports CSV by running a SPARQL CONSTRUCT mapping over each
row: the row's cells are bound as properties of a row resource, and the query builds
the RDF you want from them. The mapping for categories, categories.rq:
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dct: <http://purl.org/dc/terms/>
PREFIX schema: <https://schema.org/>
CONSTRUCT
{
GRAPH ?graph
{
?graph dct:title ?categoryName ;
foaf:primaryTopic ?category .
?category a schema:ProductGroup ;
dct:title ?categoryName ;
schema:name ?categoryName ;
schema:identifier ?categoryID ;
schema:description ?description .
}
}
WHERE
{
?category_row <#categoryID> ?categoryID ;
<#description> ?description ;
<#categoryName> ?categoryName .
BIND(uri(concat(str($base), "categories/")) AS ?container)
BIND(uri(concat(str(?container), encode_for_uri(?categoryID), "/")) AS ?graph)
BIND(uri(concat(str(?graph), "#this")) AS ?category)
}
The three BINDs carry the whole document model of the import:
?container— the target container from the Structure stage, resolved against$base?graph— one document (named graph) per row, minted inside the container from the row's identifier?category— the document's topic: the document is about the category, so the category is a #this fragment of it
In the browser
Create the import from the UI — upload the CSV file, pick the mapping query and the target container — following the Import CSV data guide.
From the command line
Each import pairs a mapping query with a CSV file and a target container. The demo lists them in a manifest, imports.csv:
query_filename,csv_filename,target,title categories/categories.rq,categories/categories.csv,categories/,Categories products/products.rq,products/products.csv,products/,Products orders/orders.rq,orders/orders.csv,orders/,Orders ...
and replays the manifest with a small script built on the CLI's create-csv-import.sh:
./import-csv.sh "$base" "$cert_pem_file" "$cert_password" "$PWD/imports.csv"
Imports run asynchronously — each one is itself a document that records its status.
What you now see
The Categories container lists eight category documents. Open one: the category renders with its name, description and identifier, typed as a product group — with the labels coming from the Model stage. Repeat the pattern for the remaining entities and the Knowledge Graph fills in, orders linking to products, products to suppliers and categories.
Next: Media