Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Automate the generation of the examples #123

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions examples/rebuild-examples.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash
set -e

PROJECT_DIR=$(dirname $(dirname "$0"))
JAR="$PROJECT_DIR/target/table2qb.jar"
TABLE2QB="java -jar $JAR"
#TABLE2QB="lein run"

BASE_URI="http://gss-data.org.uk/"

EXAMPLE_DIR="$PROJECT_DIR/examples/regional-trade"
CSV_DIR="$EXAMPLE_DIR/csv"
CSVW_DIR="$EXAMPLE_DIR/csvw"

rm -f "$CSVW_DIR/*"
$TABLE2QB csvw components-pipeline \
--input-csv "$CSV_DIR/components.csv" \
--base-uri $BASE_URI \
--output-directory "$CSVW_DIR"
$TABLE2QB csvw codelist-pipeline \
--codelist-csv "$CSV_DIR/flow-directions.csv" \
--codelist-name "Flow Directions Codelist" \
--codelist-slug "flow-directions" \
--base-uri $BASE_URI \
--output-directory "$CSVW_DIR"
$TABLE2QB csvw codelist-pipeline \
--codelist-csv "$CSV_DIR/sitc-sections.csv" \
--codelist-name "SITC Sections Codelist" \
--codelist-slug "sitc-sections" \
--base-uri $BASE_URI \
--output-directory "$CSVW_DIR"
$TABLE2QB csvw codelist-pipeline \
--codelist-csv "$CSV_DIR/units.csv" \
--codelist-name "Units" \
--codelist-slug "units" \
--base-uri $BASE_URI \
--output-directory "$CSVW_DIR"
$TABLE2QB csvw cube-pipeline \
--column-config "$EXAMPLE_DIR/columns.csv" \
--input-csv "$CSV_DIR/input.csv" \
--dataset-name "Regional Trade" \
--dataset-slug "regional-trade" \
--base-uri $BASE_URI \
--output-directory "$CSVW_DIR"

8 changes: 4 additions & 4 deletions examples/regional-trade/csvw/component-specifications.csv
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
component_slug,component_attachment,component_property
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is basically just an ordering change

date,qb:dimension,http://purl.org/linked-data/sdmx/2009/dimension#refPeriod
sitc_section,qb:dimension,http://gss-data.org.uk/def/dimension/sitc-section
flow,qb:dimension,http://gss-data.org.uk/def/dimension/flow
gbp_total,qb:measure,http://gss-data.org.uk/def/measure/gbp-total
geography,qb:dimension,http://purl.org/linked-data/sdmx/2009/dimension#refArea
measure_type,qb:dimension,http://purl.org/linked-data/cube#measureType
net_mass,qb:measure,http://gss-data.org.uk/def/measure/net-mass
sitc_section,qb:dimension,http://gss-data.org.uk/def/dimension/sitc-section
geography,qb:dimension,http://purl.org/linked-data/sdmx/2009/dimension#refArea
unit,qb:attribute,http://purl.org/linked-data/sdmx/2009/attribute#unitMeasure
net_mass,qb:measure,http://gss-data.org.uk/def/measure/net-mass
gbp_total,qb:measure,http://gss-data.org.uk/def/measure/gbp-total
34 changes: 0 additions & 34 deletions examples/regional-trade/csvw/component-specifications.json

This file was deleted.

88 changes: 1 addition & 87 deletions examples/regional-trade/csvw/components.json
Original file line number Diff line number Diff line change
@@ -1,87 +1 @@
{
"@context": [
"http://www.w3.org/ns/csvw",
{
"@language": "en"
}
],
"@id": "http://gss-data.org.uk/def/ontology/components",
"url": "components.csv",
"dc:title": "Components Ontology",
"rdfs:label": "Components Ontology",
"rdf:type": {
"@id": "owl:Ontology"
},
"tableSchema": {
"columns": [
{
"name": "label",
"titles": "label",
"datatype": "string",
"propertyUrl": "rdfs:label"
},
{
"name": "description",
"titles": "description",
"datatype": "string",
"propertyUrl": "dc:description"
},
{
"name": "component_type",
"titles": "component_type",
"propertyUrl": "rdf:type",
"valueUrl": "{+component_type}"
},
{
"name": "codelist",
"titles": "codelist",
"datatype": "string",
"propertyUrl": "qb:codeList",
"valueUrl": "{+codelist}"
},
{
"name": "notation",
"titles": "notation",
"datatype": "string",
"propertyUrl": "skos:notation"
},
{
"name": "component_type_slug",
"titles": "component_type_slug",
"datatype": "string",
"suppressOutput": true
},
{
"name": "property_slug",
"titles": "property_slug",
"datatype": "string",
"suppressOutput": true
},
{
"name": "class_slug",
"titles": "class_slug",
"datatype": "string",
"propertyUrl": "rdfs:range",
"valueUrl": "http://gss-data.org.uk/def/{class_slug}"
},
{
"name": "parent_property",
"titles": "parent_property",
"datatype": "string",
"propertyUrl": "rdfs:subPropertyOf",
"valueUrl": "{+parent_property}"
},
{
"propertyUrl": "rdfs:isDefinedBy",
"virtual": true,
"valueUrl": "http://gss-data.org.uk/def/ontology/components"
},
{
"propertyUrl": "rdf:type",
"virtual": true,
"valueUrl": "rdf:Property"
}
],
"aboutUrl": "http://gss-data.org.uk/def/{component_type_slug}/{notation}"
}
}
{"@context":["http:\/\/www.w3.org\/ns\/csvw",{"@language":"en"}],"@id":"http:\/\/gss-data.org.uk\/def\/ontology\/components","url":"components.csv","dc:title":"Components Ontology","rdfs:label":"Components Ontology","rdf:type":{"@id":"owl:Ontology"},"tableSchema":{"columns":[{"name":"label","titles":"label","datatype":"string","propertyUrl":"rdfs:label"},{"name":"description","titles":"description","datatype":"string","propertyUrl":"dc:description"},{"name":"component_type","titles":"component_type","propertyUrl":"rdf:type","valueUrl":"{+component_type}"},{"name":"codelist","titles":"codelist","datatype":"string","propertyUrl":"qb:codeList","valueUrl":"{+codelist}"},{"name":"notation","titles":"notation","datatype":"string","propertyUrl":"skos:notation"},{"name":"component_type_slug","titles":"component_type_slug","datatype":"string","suppressOutput":true},{"name":"property_slug","titles":"property_slug","datatype":"string","suppressOutput":true},{"name":"class_slug","titles":"class_slug","datatype":"string","propertyUrl":"rdfs:range","valueUrl":"http:\/\/gss-data.org.uk\/def\/{class_slug}"},{"name":"parent_property","titles":"parent_property","datatype":"string","propertyUrl":"rdfs:subPropertyOf","valueUrl":"{+parent_property}"},{"propertyUrl":"rdfs:isDefinedBy","virtual":true,"valueUrl":"http:\/\/gss-data.org.uk\/def\/ontology\/components"},{"propertyUrl":"rdf:type","virtual":true,"valueUrl":"rdf:Property"}],"aboutUrl":"http:\/\/gss-data.org.uk\/def\/{component_type_slug}\/{notation}"}}
27 changes: 0 additions & 27 deletions examples/regional-trade/csvw/data-structure-definition.json

This file was deleted.

24 changes: 0 additions & 24 deletions examples/regional-trade/csvw/dataset.json

This file was deleted.

6 changes: 3 additions & 3 deletions examples/regional-trade/csvw/flow-directions.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Label,Notation,Parent Notation
Export,export,
Import,import,
label,notation,parent_notation,sort_priority,description,top_concept_of,has_top_concept,pref_label
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we see the benefit of doing this. We didn't keep this file up-to-date as these extra columns were introduced.

Export,export,,,,yes,yes,Export
Import,import,,,,yes,yes,Import
64 changes: 1 addition & 63 deletions examples/regional-trade/csvw/flow-directions.json
Original file line number Diff line number Diff line change
@@ -1,63 +1 @@
{
"@context": ["http://www.w3.org/ns/csvw", {"@language": "en"}],
"@id": "http://gss-data.org.uk/def/concept-scheme/flow-directions",
"url": "flow-directions-codelist.csv",
"dc:title": "Flow Directions Codelist",
"rdfs:label": "Flow Directions Codelist",
"rdf:type": { "@id": "skos:ConceptScheme" },
"tableSchema": {
"aboutUrl": "http://gss-data.org.uk/def/concept/flow-directions/{notation}",
"columns": [{
"name": "label",
"titles": "label",
"datatype": "string",
"propertyUrl": "rdfs:label"
},{
"name": "notation",
"titles": "notation",
"datatype": "string",
"propertyUrl": "skos:notation"
},{
"name": "parent_notation",
"titles": "parent_notation",
"datatype": "string",
"propertyUrl": "skos:broader",
"valueUrl": "http://gss-data.org.uk/def/concept/flow-directions/{parent_notation}"
},{
"name": "sort_priority",
"titles": "sort_priority",
"datatype": "integer",
"propertyUrl": "http://www.w3.org/ns/ui#sortPriority"
},{
"name": "description",
"titles": "description",
"datatype": "string",
"propertyUrl": "rdfs:comment"
},{
"name": "top_concept_of",
"titles": "top_concept_of",
"propertyUrl": "skos:topConceptOf",
"valueUrl": "http://gss-data.org.uk/def/concept-scheme/flow-directions"
},{
"name": "has_top_concept",
"titles" "has_top_concept",
"aboutUrl": "http://gss-data.org.uk/def/concept-scheme/flow-directions",
"propertyUrl": "skos:hasTopConcept",
"valueUrl": "http://gss-data.org.uk/def/concept/flow-directions/{notation}"
},
{
"name": "pref_label",
"titles": "pref_label",
"propertyUrl": "skos:prefLabel"
},
{
"propertyUrl": "skos:inScheme",
"valueUrl": "http://gss-data.org.uk/def/concept-scheme/flow-directions",
"virtual": true
},{
"propertyUrl": "rdf:type",
"valueUrl": "skos:Concept",
"virtual": true
}]
}
}
{"@context":["http:\/\/www.w3.org\/ns\/csvw",{"@language":"en"}],"@id":"http:\/\/gss-data.org.uk\/def\/concept-scheme\/flow-directions","url":"flow-directions.csv","dc:title":"Flow Directions Codelist","rdfs:label":"Flow Directions Codelist","rdf:type":{"@id":"skos:ConceptScheme"},"tableSchema":{"aboutUrl":"http:\/\/gss-data.org.uk\/def\/concept\/flow-directions\/{notation}","columns":[{"name":"label","titles":"label","datatype":"string","propertyUrl":"rdfs:label"},{"name":"notation","titles":"notation","datatype":"string","propertyUrl":"skos:notation"},{"name":"parent_notation","titles":"parent_notation","datatype":"string","propertyUrl":"skos:broader","valueUrl":"http:\/\/gss-data.org.uk\/def\/concept\/flow-directions\/{parent_notation}"},{"name":"sort_priority","titles":"sort_priority","datatype":"integer","propertyUrl":"http:\/\/www.w3.org\/ns\/ui#sortPriority"},{"name":"description","titles":"description","datatype":"string","propertyUrl":"rdfs:comment"},{"name":"top_concept_of","titles":"top_concept_of","propertyUrl":"skos:topConceptOf","valueUrl":"http:\/\/gss-data.org.uk\/def\/concept-scheme\/flow-directions"},{"name":"has_top_concept","titles":"has_top_concept","aboutUrl":"http:\/\/gss-data.org.uk\/def\/concept-scheme\/flow-directions","propertyUrl":"skos:hasTopConcept","valueUrl":"http:\/\/gss-data.org.uk\/def\/concept\/flow-directions\/{notation}"},{"name":"pref_label","titles":"pref_label","propertyUrl":"skos:prefLabel"},{"propertyUrl":"skos:inScheme","valueUrl":"http:\/\/gss-data.org.uk\/def\/concept-scheme\/flow-directions","virtual":true},{"propertyUrl":"rdf:type","valueUrl":"skos:Concept","virtual":true}]}}
68 changes: 0 additions & 68 deletions examples/regional-trade/csvw/observations.json

This file was deleted.

Loading