diff --git a/demo/city-graph/Makefile b/demo/copenhagen/Makefile similarity index 100% rename from demo/city-graph/Makefile rename to demo/copenhagen/Makefile diff --git a/demo/city-graph/admin/clear-ontologies.sh b/demo/copenhagen/admin/clear-ontologies.sh similarity index 74% rename from demo/city-graph/admin/clear-ontologies.sh rename to demo/copenhagen/admin/clear-ontologies.sh index 8461c17..c25f666 100755 --- a/demo/city-graph/admin/clear-ontologies.sh +++ b/demo/copenhagen/admin/clear-ontologies.sh @@ -17,9 +17,17 @@ else proxy="$base" fi +admin_uri() { + local uri="$1" + echo "$uri" | sed 's|://|://admin.|' +} + +admin_base=$(admin_uri "$base") +admin_proxy=$(admin_uri "$proxy") + clear-ontology.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ - -b "${base}admin/" \ - --proxy "$proxy" \ + -b "$admin_base" \ + --proxy "$admin_proxy" \ --ontology "${base}ns#" diff --git a/demo/city-graph/admin/model/add-classes.sh b/demo/copenhagen/admin/model/add-classes.sh similarity index 69% rename from demo/city-graph/admin/model/add-classes.sh rename to demo/copenhagen/admin/model/add-classes.sh index 49fb29b..12f97e3 100755 --- a/demo/city-graph/admin/model/add-classes.sh +++ b/demo/copenhagen/admin/model/add-classes.sh @@ -17,92 +17,100 @@ else proxy="$base" fi +admin_uri() { + local uri="$1" + echo "$uri" | sed 's|://|://admin.|' +} + +admin_base=$(admin_uri "$base") +admin_proxy=$(admin_uri "$proxy") + add-class.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --uri "${base}ns#BicycleParking" \ --label "Bicycle parking" \ --sub-class-of "https://schema.org/CivicStructure" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" add-class.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --uri "${base}ns#ChargingStation" \ --label "Charging station" \ --sub-class-of "https://schema.org/CivicStructure" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" add-class.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --uri "${base}ns#Library" \ --label "Library" \ --sub-class-of "https://schema.org/Library" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" add-class.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --uri "${base}ns#ParkingFacility" \ --label "Parking facility" \ --sub-class-of "https://schema.org/ParkingFacility" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" add-class.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --uri "${base}ns#Place" \ --label "Place" \ --sub-class-of "https://schema.org/CivicStructure" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" add-class.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --uri "${base}ns#Playground" \ --label "Playground" \ --sub-class-of "https://schema.org/Playground" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" add-class.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --uri "${base}ns#School" \ --label "School" \ --sub-class-of "https://schema.org/School" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" add-class.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --uri "${base}ns#SportsCenter" \ --label "Sports center" \ --sub-class-of "https://schema.org/CivicStructure" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" add-class.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --uri "${base}ns#PublicToilet" \ --label "Toilet" \ --sub-class-of "http://schema.org/PublicToilet" \ - "${base}admin/ontologies/namespace/" + "${admin_base}ontologies/namespace/" diff --git a/demo/city-graph/create-charts.sh b/demo/copenhagen/create-charts.sh similarity index 96% rename from demo/city-graph/create-charts.sh rename to demo/copenhagen/create-charts.sh index 2819572..3c4be6a 100755 --- a/demo/city-graph/create-charts.sh +++ b/demo/copenhagen/create-charts.sh @@ -37,7 +37,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Largest parking facilities" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "${pwd}/queries/charts/parking-facilities-by-spaces.rq" \ "$chart_doc" @@ -47,7 +47,7 @@ add-result-set-chart.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Largest parking facilities" \ - --fragment this \ + --uri "#this" \ --query "${chart_doc}#${query_id}" \ --chart-type "https://w3id.org/atomgraph/client#BarChart" \ --category-var-name "name" \ diff --git a/demo/city-graph/create-containers.sh b/demo/copenhagen/create-containers.sh similarity index 84% rename from demo/city-graph/create-containers.sh rename to demo/copenhagen/create-containers.sh index 63d2e34..44ebf5b 100755 --- a/demo/city-graph/create-containers.sh +++ b/demo/copenhagen/create-containers.sh @@ -17,21 +17,6 @@ else proxy="$base" fi -parent=$( -create-container.sh \ - -b "$base" \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$proxy" \ - --title "Copenhagen" \ - --slug "copenhagen" \ - --parent "$base" -) - -if [ -z "$parent" ]; then - exit 1 -fi - create-container.sh \ -b "$base" \ -f "$cert_pem_file" \ @@ -39,7 +24,7 @@ create-container.sh \ --proxy "$proxy" \ --title "Places" \ --slug "places" \ - --parent "$parent" \ + --parent "$base" \ --mode "https://w3id.org/atomgraph/client#MapMode" create-container.sh \ @@ -49,7 +34,7 @@ create-container.sh \ --proxy "$proxy" \ --title "Bicycle parkings" \ --slug "bicycle-parkings" \ - --parent "$parent" \ + --parent "$base" \ --mode "https://w3id.org/atomgraph/client#MapMode" create-container.sh \ @@ -59,7 +44,7 @@ create-container.sh \ --proxy "$proxy" \ --title "Charging stations" \ --slug "charging-stations" \ - --parent "$parent" \ + --parent "$base" \ --mode "https://w3id.org/atomgraph/client#MapMode" create-container.sh \ @@ -69,7 +54,7 @@ create-container.sh \ --proxy "$proxy" \ --title "Libraries" \ --slug "libraries" \ - --parent "$parent" \ + --parent "$base" \ --mode "https://w3id.org/atomgraph/client#MapMode" create-container.sh \ @@ -79,7 +64,7 @@ create-container.sh \ --proxy "$proxy" \ --title "Parking facilities" \ --slug "parking-facilities" \ - --parent "$parent" \ + --parent "$base" \ --mode "https://w3id.org/atomgraph/client#MapMode" create-container.sh \ @@ -89,7 +74,7 @@ create-container.sh \ --proxy "$proxy" \ --title "Playgrounds" \ --slug "playgrounds" \ - --parent "$parent" \ + --parent "$base" \ --mode "https://w3id.org/atomgraph/client#MapMode" create-container.sh \ @@ -99,7 +84,7 @@ create-container.sh \ --proxy "$proxy" \ --title "Schools" \ --slug "schools" \ - --parent "$parent" \ + --parent "$base" \ --mode "https://w3id.org/atomgraph/client#MapMode" create-container.sh \ @@ -109,7 +94,7 @@ create-container.sh \ --proxy "$proxy" \ --title "Sport centers" \ --slug "sports-centers" \ - --parent "$parent" \ + --parent "$base" \ --mode "https://w3id.org/atomgraph/client#MapMode" create-container.sh \ @@ -119,5 +104,5 @@ create-container.sh \ --proxy "$proxy" \ --title "Public toilets" \ --slug "public-toilets" \ - --parent "$parent" \ + --parent "$base" \ --mode "https://w3id.org/atomgraph/client#MapMode" diff --git a/demo/city-graph/files/copenhagen/bicycle-parkings.csv b/demo/copenhagen/files/copenhagen/bicycle-parkings.csv similarity index 100% rename from demo/city-graph/files/copenhagen/bicycle-parkings.csv rename to demo/copenhagen/files/copenhagen/bicycle-parkings.csv diff --git a/demo/city-graph/files/copenhagen/charging-stations.csv b/demo/copenhagen/files/copenhagen/charging-stations.csv similarity index 100% rename from demo/city-graph/files/copenhagen/charging-stations.csv rename to demo/copenhagen/files/copenhagen/charging-stations.csv diff --git a/demo/city-graph/files/copenhagen/libraries.csv b/demo/copenhagen/files/copenhagen/libraries.csv similarity index 100% rename from demo/city-graph/files/copenhagen/libraries.csv rename to demo/copenhagen/files/copenhagen/libraries.csv diff --git a/demo/city-graph/files/copenhagen/parking-facilities.csv b/demo/copenhagen/files/copenhagen/parking-facilities.csv similarity index 100% rename from demo/city-graph/files/copenhagen/parking-facilities.csv rename to demo/copenhagen/files/copenhagen/parking-facilities.csv diff --git a/demo/city-graph/files/copenhagen/places.csv b/demo/copenhagen/files/copenhagen/places.csv similarity index 100% rename from demo/city-graph/files/copenhagen/places.csv rename to demo/copenhagen/files/copenhagen/places.csv diff --git a/demo/city-graph/files/copenhagen/playgrounds.csv b/demo/copenhagen/files/copenhagen/playgrounds.csv similarity index 100% rename from demo/city-graph/files/copenhagen/playgrounds.csv rename to demo/copenhagen/files/copenhagen/playgrounds.csv diff --git a/demo/city-graph/files/copenhagen/public-toilets.csv b/demo/copenhagen/files/copenhagen/public-toilets.csv similarity index 100% rename from demo/city-graph/files/copenhagen/public-toilets.csv rename to demo/copenhagen/files/copenhagen/public-toilets.csv diff --git a/demo/city-graph/files/copenhagen/schools.csv b/demo/copenhagen/files/copenhagen/schools.csv similarity index 100% rename from demo/city-graph/files/copenhagen/schools.csv rename to demo/copenhagen/files/copenhagen/schools.csv diff --git a/demo/city-graph/files/copenhagen/sports-centers.csv b/demo/copenhagen/files/copenhagen/sports-centers.csv similarity index 100% rename from demo/city-graph/files/copenhagen/sports-centers.csv rename to demo/copenhagen/files/copenhagen/sports-centers.csv diff --git a/demo/city-graph/import-csv.sh b/demo/copenhagen/import-csv.sh similarity index 100% rename from demo/city-graph/import-csv.sh rename to demo/copenhagen/import-csv.sh diff --git a/demo/city-graph/imports.csv b/demo/copenhagen/imports.csv similarity index 100% rename from demo/city-graph/imports.csv rename to demo/copenhagen/imports.csv diff --git a/demo/city-graph/install.sh b/demo/copenhagen/install.sh similarity index 100% rename from demo/city-graph/install.sh rename to demo/copenhagen/install.sh diff --git a/demo/city-graph/queries/charts/parking-facilities-by-spaces.rq b/demo/copenhagen/queries/charts/parking-facilities-by-spaces.rq similarity index 100% rename from demo/city-graph/queries/charts/parking-facilities-by-spaces.rq rename to demo/copenhagen/queries/charts/parking-facilities-by-spaces.rq diff --git a/demo/city-graph/queries/imports/copenhagen/bicycle-parkings.rq b/demo/copenhagen/queries/imports/copenhagen/bicycle-parkings.rq similarity index 95% rename from demo/city-graph/queries/imports/copenhagen/bicycle-parkings.rq rename to demo/copenhagen/queries/imports/copenhagen/bicycle-parkings.rq index 2e6aa7a..2e9b01e 100644 --- a/demo/city-graph/queries/imports/copenhagen/bicycle-parkings.rq +++ b/demo/copenhagen/queries/imports/copenhagen/bicycle-parkings.rq @@ -44,7 +44,7 @@ WHERE OPTIONAL { ?bicyleParking_row <#antal_pladser> ?spaces } - BIND(uri(concat(str($base), "copenhagen/bicycle-parkings/")) AS ?container) + BIND(uri(concat(str($base), "bicycle-parkings/")) AS ?container) BIND(uri(concat(str(?container), encode_for_uri(?id), "/")) AS ?item) BIND(uri(concat(str(?item), "#this")) AS ?bicyleParking) BIND(xsd:float(?lat_string) AS ?lat) diff --git a/demo/city-graph/queries/imports/copenhagen/charging-stations.rq b/demo/copenhagen/queries/imports/copenhagen/charging-stations.rq similarity index 95% rename from demo/city-graph/queries/imports/copenhagen/charging-stations.rq rename to demo/copenhagen/queries/imports/copenhagen/charging-stations.rq index f1b0bfa..cc5bcea 100644 --- a/demo/city-graph/queries/imports/copenhagen/charging-stations.rq +++ b/demo/copenhagen/queries/imports/copenhagen/charging-stations.rq @@ -49,7 +49,7 @@ WHERE OPTIONAL { ?charger_row <#bem> ?information } - BIND(uri(concat(str($base), "copenhagen/charging-stations/")) AS ?container) + BIND(uri(concat(str($base), "charging-stations/")) AS ?container) BIND(uri(concat(str(?container), encode_for_uri(?id), "/")) AS ?item) BIND(uri(concat(str(?item), "#this")) AS ?charger) BIND(xsd:float(?lat_string) AS ?lat) diff --git a/demo/city-graph/queries/imports/copenhagen/libraries.rq b/demo/copenhagen/queries/imports/copenhagen/libraries.rq similarity index 95% rename from demo/city-graph/queries/imports/copenhagen/libraries.rq rename to demo/copenhagen/queries/imports/copenhagen/libraries.rq index 8ac07d4..cb16161 100644 --- a/demo/city-graph/queries/imports/copenhagen/libraries.rq +++ b/demo/copenhagen/queries/imports/copenhagen/libraries.rq @@ -51,7 +51,7 @@ WHERE BIND (URI(?linkString) AS ?link) } - BIND(uri(concat(str($base), "copenhagen/libraries/")) AS ?container) + BIND(uri(concat(str($base), "libraries/")) AS ?container) BIND(uri(concat(str(?container), encode_for_uri(?id), "/")) AS ?item) BIND(uri(concat(str(?item), "#this")) AS ?library) BIND(xsd:float(?lat_string) AS ?lat) diff --git a/demo/city-graph/queries/imports/copenhagen/parking-facilities.rq b/demo/copenhagen/queries/imports/copenhagen/parking-facilities.rq similarity index 96% rename from demo/city-graph/queries/imports/copenhagen/parking-facilities.rq rename to demo/copenhagen/queries/imports/copenhagen/parking-facilities.rq index 5ae06ed..17fc371 100644 --- a/demo/city-graph/queries/imports/copenhagen/parking-facilities.rq +++ b/demo/copenhagen/queries/imports/copenhagen/parking-facilities.rq @@ -54,7 +54,7 @@ WHERE BIND ( AS ?owner) # Copenhagen Municipality } - BIND(uri(concat(str($base), "copenhagen/parking-facilities/")) AS ?container) + BIND(uri(concat(str($base), "parking-facilities/")) AS ?container) BIND(uri(concat(str(?container), encode_for_uri(?id), "/")) AS ?item) BIND(uri(concat(str(?item), "#this")) AS ?parking) BIND(xsd:float(?lat_string) AS ?lat) diff --git a/demo/city-graph/queries/imports/copenhagen/places.rq b/demo/copenhagen/queries/imports/copenhagen/places.rq similarity index 94% rename from demo/city-graph/queries/imports/copenhagen/places.rq rename to demo/copenhagen/queries/imports/copenhagen/places.rq index b17dd8c..f218074 100644 --- a/demo/city-graph/queries/imports/copenhagen/places.rq +++ b/demo/copenhagen/queries/imports/copenhagen/places.rq @@ -36,7 +36,7 @@ WHERE OPTIONAL { ?place_row <#category> ?category_name } - BIND(uri(concat(str($base), "copenhagen/places/")) AS ?container) + BIND(uri(concat(str($base), "places/")) AS ?container) BIND(uri(concat(str(?container), encode_for_uri(?id), "/")) AS ?item) BIND(uri(concat(str(?item), "#this")) AS ?place) BIND(xsd:float(?lat_string) AS ?lat) diff --git a/demo/city-graph/queries/imports/copenhagen/playgrounds.rq b/demo/copenhagen/queries/imports/copenhagen/playgrounds.rq similarity index 96% rename from demo/city-graph/queries/imports/copenhagen/playgrounds.rq rename to demo/copenhagen/queries/imports/copenhagen/playgrounds.rq index 628b35d..0bce09b 100644 --- a/demo/city-graph/queries/imports/copenhagen/playgrounds.rq +++ b/demo/copenhagen/queries/imports/copenhagen/playgrounds.rq @@ -50,7 +50,7 @@ WHERE { ?playground_row <#link> ?linkString BIND (URI(?linkString) AS ?link)} - BIND(uri(concat(str($base), "copenhagen/playgrounds/")) AS ?container) + BIND(uri(concat(str($base), "playgrounds/")) AS ?container) BIND(uri(concat(str(?container), encode_for_uri(?id), "/")) AS ?item) BIND(uri(concat(str(?item), "#this")) AS ?playground) BIND(xsd:float(?lat_string) AS ?lat) . diff --git a/demo/city-graph/queries/imports/copenhagen/public-toilets.rq b/demo/copenhagen/queries/imports/copenhagen/public-toilets.rq similarity index 95% rename from demo/city-graph/queries/imports/copenhagen/public-toilets.rq rename to demo/copenhagen/queries/imports/copenhagen/public-toilets.rq index 3d76d05..5d3639d 100644 --- a/demo/city-graph/queries/imports/copenhagen/public-toilets.rq +++ b/demo/copenhagen/queries/imports/copenhagen/public-toilets.rq @@ -46,7 +46,7 @@ WHERE OPTIONAL { ?toilet_row <#aabningstid_bemrk> ?comment } OPTIONAL { ?toilet_row <#opening_hours> ?openingHours } - BIND(uri(concat(str($base), "copenhagen/public-toilets/")) AS ?container) + BIND(uri(concat(str($base), "public-toilets/")) AS ?container) BIND(uri(concat(str(?container), encode_for_uri(?id), "/")) AS ?item) BIND(uri(concat(str(?item), "#this")) AS ?toilet) BIND(xsd:float(?lat_string) AS ?lat) diff --git a/demo/city-graph/queries/imports/copenhagen/schools.rq b/demo/copenhagen/queries/imports/copenhagen/schools.rq similarity index 95% rename from demo/city-graph/queries/imports/copenhagen/schools.rq rename to demo/copenhagen/queries/imports/copenhagen/schools.rq index dad0b9b..2ef0e27 100644 --- a/demo/city-graph/queries/imports/copenhagen/schools.rq +++ b/demo/copenhagen/queries/imports/copenhagen/schools.rq @@ -48,7 +48,7 @@ WHERE BIND (URI(?linkString) AS ?link) } - BIND (uri(concat(str($base), "copenhagen/schools/")) AS ?container) + BIND (uri(concat(str($base), "schools/")) AS ?container) BIND(uri(concat(str(?container), encode_for_uri(?id), "/")) AS ?item) BIND(uri(concat(str(?item), "#this")) AS ?school) BIND(xsd:float(?lat_string) AS ?lat) diff --git a/demo/city-graph/queries/imports/copenhagen/sports-centers.rq b/demo/copenhagen/queries/imports/copenhagen/sports-centers.rq similarity index 95% rename from demo/city-graph/queries/imports/copenhagen/sports-centers.rq rename to demo/copenhagen/queries/imports/copenhagen/sports-centers.rq index 65b469d..f4cca66 100644 --- a/demo/city-graph/queries/imports/copenhagen/sports-centers.rq +++ b/demo/copenhagen/queries/imports/copenhagen/sports-centers.rq @@ -46,7 +46,7 @@ WHERE BIND (URI(?linkString) AS ?link) } - BIND(uri(concat(str($base), "copenhagen/sports-centers/")) AS ?container) + BIND(uri(concat(str($base), "sports-centers/")) AS ?container) BIND(uri(concat(str(?container), encode_for_uri(?id), "/")) AS ?item) BIND(uri(concat(str(?item), "#this")) AS ?sportCenter) BIND(xsd:float(?lat_string) AS ?lat) diff --git a/demo/city-graph/root.ttl b/demo/copenhagen/root.ttl similarity index 93% rename from demo/city-graph/root.ttl rename to demo/copenhagen/root.ttl index 4b2fabf..146d80b 100644 --- a/demo/city-graph/root.ttl +++ b/demo/copenhagen/root.ttl @@ -8,7 +8,7 @@ @prefix sioc: . <> a def:Root ; - dct:title "City Graph" ; + dct:title "Copenhagen" ; dct:description "Geospatial and other open data about cities, imported by transforming CSV files to RDF" ; rdf:_1 <#page-header> ; rdf:_2 <#main-library> ; @@ -20,7 +20,7 @@ <#page-header> a ldh:XHTML ; rdf:value """

Features include CSV data imports, SPARQL-based charts, faceted search and related results (parallax navigation) as well as @@ -31,7 +31,7 @@

"""^^rdf:XMLLiteral . <#main-library> a ldh:Object ; - rdf:value ; + rdf:value ; ac:mode ac:MapMode . <#charts> a ldh:XHTML ; diff --git a/demo/city-graph/screenshot.png b/demo/copenhagen/screenshot.png similarity index 100% rename from demo/city-graph/screenshot.png rename to demo/copenhagen/screenshot.png diff --git a/demo/city-graph/update-documents.sh b/demo/copenhagen/update-documents.sh similarity index 100% rename from demo/city-graph/update-documents.sh rename to demo/copenhagen/update-documents.sh diff --git a/demo/northwind-traders/admin/clear-ontologies.sh b/demo/northwind-traders/admin/clear-ontologies.sh deleted file mode 100755 index 8461c17..0000000 --- a/demo/northwind-traders/admin/clear-ontologies.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then - echo "Usage: $0" '$base $cert_pem_file $cert_password [$proxy]' >&2 - echo "Example: $0" 'https://localhost:4443/ ../../../../../../ssl/owner/cert.pem Password [https://localhost:5443/]' >&2 - echo "Note: special characters such as $ need to be escaped in passwords!" >&2 - exit 1 -fi - -base="$1" -cert_pem_file="$(realpath "$2")" -cert_password="$3" - -if [ -n "$4" ]; then - proxy="$4" -else - proxy="$base" -fi - -clear-ontology.sh \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - -b "${base}admin/" \ - --proxy "$proxy" \ - --ontology "${base}ns#" diff --git a/demo/northwind-traders/admin/model/add-imports.sh b/demo/northwind-traders/admin/model/add-imports.sh deleted file mode 100755 index ec52718..0000000 --- a/demo/northwind-traders/admin/model/add-imports.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then - echo "Usage: $0" '$base $cert_pem_file $cert_password [$proxy]' >&2 - echo "Example: $0" 'https://localhost:4443/demo/northwind-traders/ ../../../../../ssl/owner/cert.pem Password [https://localhost:5443/]' >&2 - echo "Note: special characters such as $ need to be escaped in passwords!" >&2 - exit 1 -fi - -base="$1" -cert_pem_file=$(realpath "$2") -cert_password="$3" - -if [ -n "$4" ]; then - proxy="$4" -else - proxy="$base" -fi - -add-ontology-import.sh \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$proxy" \ - --import "https://schema.org/" \ - "${base}admin/ontologies/namespace/" diff --git a/demo/northwind-traders/admin/model/import-ns.sh b/demo/northwind-traders/admin/model/import-ns.sh new file mode 100755 index 0000000..e90c29d --- /dev/null +++ b/demo/northwind-traders/admin/model/import-ns.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then + echo "Usage: $0" '$base $cert_pem_file $cert_password [$proxy]' >&2 + echo "Example: $0" 'https://localhost:4443/demo/northwind-traders/ ../../../../../ssl/owner/cert.pem Password [https://localhost:5443/]' >&2 + echo "Note: special characters such as $ need to be escaped in passwords!" >&2 + exit 1 +fi + +base="$1" +cert_pem_file=$(realpath "$2") +cert_password="$3" + +if [ -n "$4" ]; then + proxy="$4" +else + proxy="$base" +fi + +admin_uri() { + local uri="$1" + echo "$uri" | sed 's|://|://admin.|' +} + +admin_base=$(admin_uri "$base") +admin_proxy=$(admin_uri "$proxy") + +# clear the old properties of the namespace ontology + +{ echo "BASE <${admin_base}ontologies/namespace/>"; cat patch-ontology.ru; } | patch.sh \ + -f "$cert_pem_file" \ + -p "$cert_password" \ + --proxy "$admin_proxy" \ + "${admin_base}ontologies/namespace/" + +# append the ns.ttl file to the namespace ontology +# prepend @base directive using end-user base URI so that the : prefix +# (defined as in ns.ttl) resolves to the end-user namespace + +{ echo "@base <${base}ns> ."; cat ns.ttl; } | post.sh \ + -f "$cert_pem_file" \ + -p "$cert_password" \ + --proxy "$admin_proxy" \ + --content-type "text/turtle" \ + "${admin_base}ontologies/namespace/" + +# clear the namespace ontology from memory + +clear-ontology.sh \ + -f "$cert_pem_file" \ + -p "$cert_password" \ + -b "$admin_base" \ + --proxy "$admin_proxy" \ + --ontology "${base}ns#" diff --git a/demo/northwind-traders/admin/model/import-ontologies.sh b/demo/northwind-traders/admin/model/import-ontologies.sh deleted file mode 100755 index 8c16a5d..0000000 --- a/demo/northwind-traders/admin/model/import-ontologies.sh +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env bash - -if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then - echo "Usage: $0" '$base $cert_pem_file $cert_password [$proxy]' >&2 - echo "Example: $0" 'https://localhost:4443/demo/northwind-traders/ ../../../../../ssl/owner/cert.pem Password [https://localhost:5443/]' >&2 - echo "Note: special characters such as $ need to be escaped in passwords!" >&2 - exit 1 -fi - -base="$1" -cert_pem_file=$(realpath "$2") -cert_password="$3" - -if [ -n "$4" ]; then - proxy="$4" -else - proxy="$base" -fi - -pwd=$(realpath "$PWD") - -printf "\n### Creating ontology item\n\n" - -ont_doc=$(create-item.sh \ - -b "${base}admin/" \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$proxy" \ - --title "Northwind Traders" \ - --slug "northwind-traders" \ - --container "${base}admin/ontologies/" -) - -printf "\n### Appending ontology document\n\n" - -cat "$pwd"/northwind-traders.ttl | turtle --base="$ont_doc" | post.sh \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$proxy" \ - -t "application/n-triples" \ - "$ont_doc" diff --git a/demo/northwind-traders/admin/model/northwind-traders.ttl b/demo/northwind-traders/admin/model/northwind-traders.ttl deleted file mode 100644 index 406177b..0000000 --- a/demo/northwind-traders/admin/model/northwind-traders.ttl +++ /dev/null @@ -1,78 +0,0 @@ -@prefix : . -@prefix rdf: . -@prefix rdfs: . -@prefix xsd: . -@prefix owl: . -@prefix dh: . -@prefix sioc: . -@prefix foaf: . -@prefix dct: . - -: a owl:Ontology . - -# classes - -:Person a owl:Class ; - rdfs:label "Person" ; - rdfs:isDefinedBy : . - -:Order a owl:Class ; - rdfs:label "Order" ; - rdfs:isDefinedBy : . - -:City a owl:Class ; - rdfs:label "City" ; - rdfs:isDefinedBy : . - -:PostalAddress a owl:Class ; - rdfs:label "Postal address" ; - rdfs:isDefinedBy : . - -# properties - -:broker a owl:ObjectProperty ; - rdfs:label "Broker"; - rdfs:domain :Order ; - rdfs:range :Person ; - rdfs:isDefinedBy : . - -:areaServed a owl:ObjectProperty ; - rdfs:label "Area served"; - rdfs:domain :Person ; - rdfs:range :City ; - rdfs:isDefinedBy : . - -:address a owl:ObjectProperty ; - rdfs:label "Address"; - rdfs:domain :Person ; - rdfs:range :PostalAddress ; - rdfs:isDefinedBy : . - -# restrictions - -[] a owl:Restriction ; - owl:onProperty :broker ; - owl:minCardinality 1 ; - owl:maxCardinality 1 ; - rdfs:isDefinedBy : . - -[] a owl:Restriction ; - owl:onProperty :address ; - owl:minCardinality 1 ; - owl:maxCardinality 1 ; - rdfs:isDefinedBy : . - -# blocks - -@prefix ldh: . -@prefix sp: . -@prefix spin: . - -:Person ldh:template <#content-76b5d972-86e8-424b-83fb-d0d7abe3bb75> . - -<#content-76b5d972-86e8-424b-83fb-d0d7abe3bb75> a ldh:View ; - rdfs:label "Orders handled by this employee" ; - spin:query <#query-53e279eb-3c8c-42bd-8a81-fea183d2be01> . - -<#query-53e279eb-3c8c-42bd-8a81-fea183d2be01> a sp:Select ; - sp:text "SELECT DISTINCT ?instance { GRAPH ?g { ?instance $this } }" . \ No newline at end of file diff --git a/demo/northwind-traders/admin/model/ns.ttl b/demo/northwind-traders/admin/model/ns.ttl new file mode 100644 index 0000000..1dfe81c --- /dev/null +++ b/demo/northwind-traders/admin/model/ns.ttl @@ -0,0 +1,192 @@ +@prefix : <#> . +@prefix ldh: . +@prefix rdfs: . +@prefix rdf: . +@prefix xsd: . +@prefix owl: . +@prefix sp: . +@prefix spin: . +@prefix dct: . +@prefix dh: . +@prefix sioc: . +@prefix foaf: . +@prefix schema: . + +: a owl:Ontology . + +# classes + +schema:Person a owl:Class ; + rdfs:label "Person" ; + rdfs:isDefinedBy : . + +schema:Order a owl:Class ; + rdfs:label "Order" ; + rdfs:isDefinedBy : . + +schema:City a owl:Class ; + rdfs:label "City" ; + rdfs:isDefinedBy : . + +schema:PostalAddress a owl:Class ; + rdfs:label "Postal address" ; + rdfs:isDefinedBy : . + +# properties + +schema:broker a owl:ObjectProperty ; + rdfs:label "Broker"; + rdfs:domain schema:Order ; + rdfs:range schema:Person ; + rdfs:isDefinedBy : . + +schema:areaServed a owl:ObjectProperty ; + rdfs:label "Area served"; + rdfs:domain schema:Person ; + rdfs:range schema:City ; + rdfs:isDefinedBy : . + +schema:address a owl:ObjectProperty ; + rdfs:label "Address"; + rdfs:domain schema:Person ; + rdfs:range schema:PostalAddress ; + rdfs:isDefinedBy : . + +# restrictions + +[] a owl:Restriction ; + owl:onProperty schema:broker ; + owl:minCardinality 1 ; + owl:maxCardinality 1 ; + rdfs:isDefinedBy : . + +[] a owl:Restriction ; + owl:onProperty schema:address ; + owl:minCardinality 1 ; + owl:maxCardinality 1 ; + rdfs:isDefinedBy : . + +# Person + +# orders handled by this employee + +schema:Person ldh:template :OrdersHandledByEmployee . + +:OrdersHandledByEmployee a ldh:View ; + dct:title "Orders handled by this employee" ; + spin:query :SelectOrdersHandledByEmployee ; + rdfs:isDefinedBy : . + +:SelectOrdersHandledByEmployee a sp:Select ; + rdfs:label "Select orders handled by employee" ; + sp:text """ +PREFIX schema: + +SELECT DISTINCT ?order +WHERE + { GRAPH ?graph + { ?order schema:broker $about } + } +ORDER BY DESC(?order) +""" ; + rdfs:isDefinedBy : . + +# Corporation + +# orders from this customer + +schema:Corporation ldh:template :OrdersFromCustomer . + +:OrdersFromCustomer a ldh:View ; + dct:title "Orders from this customer" ; + spin:query :SelectOrdersFromCustomer ; + rdfs:isDefinedBy : . + +:SelectOrdersFromCustomer a sp:Select ; + rdfs:label "Select orders from customer" ; + sp:text """ +PREFIX schema: + +SELECT DISTINCT ?order +WHERE + { GRAPH ?graph + { ?order schema:customer $about } + } +ORDER BY DESC(?order) +""" ; + rdfs:isDefinedBy : . + +# products supplied by this supplier + +schema:Corporation ldh:template :ProductsFromSupplier . + +:ProductsFromSupplier a ldh:View ; + dct:title "Products supplied by this supplier" ; + spin:query :SelectProductsFromSupplier ; + rdfs:isDefinedBy : . + +:SelectProductsFromSupplier a sp:Select ; + rdfs:label "Select products from supplier" ; + sp:text """ +PREFIX schema: + +SELECT DISTINCT ?product +WHERE + { GRAPH ?graph + { ?product schema:provider $about } + } +ORDER BY ?product +""" ; + rdfs:isDefinedBy : . + +# Place + +# cities in this region + +schema:Place ldh:template :CitiesInRegion . + +:CitiesInRegion a ldh:View ; + dct:title "Cities in this region" ; + spin:query :SelectCitiesInRegion ; + rdfs:isDefinedBy : . + +:SelectCitiesInRegion a sp:Select ; + rdfs:label "Select cities in region" ; + sp:text """ +PREFIX schema: + +SELECT DISTINCT ?city +WHERE + { GRAPH ?graph + { ?city schema:containedInPlace $about } + } +ORDER BY ?city +""" ; + rdfs:isDefinedBy : . + +# Product + +# orders containing this product + +schema:Product ldh:template :OrdersContainingProduct . + +:OrdersContainingProduct a ldh:View ; + dct:title "Orders containing this product" ; + spin:query :SelectOrdersContainingProduct ; + rdfs:isDefinedBy : . + +:SelectOrdersContainingProduct a sp:Select ; + rdfs:label "Select orders containing product" ; + sp:text """ +PREFIX schema: + +SELECT DISTINCT ?order +WHERE + { GRAPH ?graph + { ?order schema:orderedItem ?orderItem . + ?orderItem schema:orderedItem $about + } + } +ORDER BY DESC(?order) +""" ; + rdfs:isDefinedBy : . diff --git a/demo/skos/admin/model/patch-ontology.ru b/demo/northwind-traders/admin/model/patch-ontology.ru similarity index 100% rename from demo/skos/admin/model/patch-ontology.ru rename to demo/northwind-traders/admin/model/patch-ontology.ru diff --git a/demo/northwind-traders/create-charts.sh b/demo/northwind-traders/create-charts.sh index e238993..8a45a9f 100755 --- a/demo/northwind-traders/create-charts.sh +++ b/demo/northwind-traders/create-charts.sh @@ -39,7 +39,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Products by sales" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "${pwd}/queries/charts/select-products-by-sales.rq" \ "$query_doc" @@ -59,7 +59,7 @@ add-result-set-chart.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Top selling products" \ - --fragment this \ + --uri "#this" \ --query "${query_doc}#${query_id}" \ --chart-type "https://w3id.org/atomgraph/client#BarChart" \ --category-var-name "productName" \ @@ -86,7 +86,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Sales by region per year" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "${pwd}/queries/charts/select-sales-by-regions-by-year.rq" \ "$query_doc" @@ -106,7 +106,7 @@ add-result-set-chart.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Sales by region per year" \ - --fragment this \ + --uri "#this" \ --query "${query_doc}#${query_id}" \ --chart-type "https://w3id.org/atomgraph/client#Table" \ --category-var-name "year" \ diff --git a/demo/northwind-traders/create-containers.sh b/demo/northwind-traders/create-containers.sh index e9b6a4f..d3ff4ac 100755 --- a/demo/northwind-traders/create-containers.sh +++ b/demo/northwind-traders/create-containers.sh @@ -45,7 +45,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select categories" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "$pwd/queries/select-categories.rq" \ "$container" @@ -56,7 +56,7 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ --mode "https://w3id.org/atomgraph/client#GridMode" \ "$container" @@ -68,7 +68,7 @@ add-object-block.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" @@ -98,7 +98,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select customers" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "$pwd/queries/select-customers.rq" \ "$container" @@ -109,7 +109,7 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ --mode "https://w3id.org/atomgraph/client#TableMode" \ "$container" @@ -121,7 +121,7 @@ add-object-block.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" @@ -151,7 +151,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select employees" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "$pwd/queries/select-employees.rq" \ "$container" @@ -162,7 +162,7 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ --mode "https://w3id.org/atomgraph/client#GridMode" \ "$container" @@ -174,7 +174,7 @@ add-object-block.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" @@ -204,7 +204,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select orders" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "$pwd/queries/select-orders.rq" \ "$container" @@ -215,7 +215,7 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ --mode "https://w3id.org/atomgraph/client#TableMode" \ "$container" @@ -227,7 +227,7 @@ add-object-block.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" @@ -257,7 +257,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select products" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "$pwd/queries/select-products.rq" \ "$container" @@ -268,7 +268,7 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ --mode "https://w3id.org/atomgraph/client#TableMode" \ "$container" @@ -280,7 +280,7 @@ add-object-block.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" @@ -310,7 +310,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select regions" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "$pwd/queries/select-regions.rq" \ "$container" @@ -321,7 +321,7 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ "$container" @@ -332,7 +332,7 @@ add-object-block.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" @@ -362,7 +362,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select shippers" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "$pwd/queries/select-shippers.rq" \ "$container" @@ -373,7 +373,7 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ "$container" @@ -384,7 +384,7 @@ add-object-block.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" @@ -414,7 +414,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select suppliers" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "$pwd/queries/select-suppliers.rq" \ "$container" @@ -425,7 +425,7 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ --mode "https://w3id.org/atomgraph/client#TableMode" \ "$container" @@ -437,7 +437,7 @@ add-object-block.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" @@ -467,7 +467,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select territories" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "$pwd/queries/select-territories.rq" \ "$container" @@ -478,9 +478,9 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ - --mode "https://w3id.org/atomgraph/client#TableMode" \ + --mode "https://w3id.org/atomgraph/client#MapMode" \ "$container" object_id="select-territories" @@ -490,7 +490,6 @@ add-object-block.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" diff --git a/demo/northwind-traders/files/territories.csv b/demo/northwind-traders/files/territories.csv index f5aabf5..e72f545 100644 --- a/demo/northwind-traders/files/territories.csv +++ b/demo/northwind-traders/files/territories.csv @@ -1,54 +1,54 @@ -territoryID,territoryDescription,regionID -01581,Westboro,1 -01730,Bedford,1 -01833,Georgetown,1 -02116,Boston,1 -02139,Cambridge,1 -02184,Braintree,1 -02903,Providence,1 -03049,Hollis,3 -03801,Portsmouth,3 -06897,Wilton,1 -07960,Morristown,1 -08837,Edison,1 -10019,New York,1 -10038,New York,1 -11747,Mellvile,1 -14450,Fairport,1 -19428,Philadelphia,3 -19713,Neward,1 -20852,Rockville,1 -27403,Greensboro,1 -27511,Cary,1 -29202,Columbia,4 -30346,Atlanta,4 -31406,Savannah,4 -32859,Orlando,4 -33607,Tampa,4 -40222,Louisville,1 -44122,Beachwood,3 -45839,Findlay,3 -48075,Southfield,3 -48084,Troy,3 -48304,Bloomfield Hills,3 -53404,Racine,3 -55113,Roseville,3 -55439,Minneapolis,3 -60179,Hoffman Estates,2 -60601,Chicago,2 -72716,Bentonville,4 -75234,Dallas,4 -78759,Austin,4 -80202,Denver,2 -80909,Colorado Springs,2 -85014,Phoenix,2 -85251,Scottsdale,2 -90405,Santa Monica,2 -94025,Menlo Park,2 -94105,San Francisco,2 -95008,Campbell,2 -95054,Santa Clara,2 -95060,Santa Cruz,2 -98004,Bellevue,2 -98052,Redmond,2 -98104,Seattle,2 +territoryID,territoryDescription,regionID,latitude,longitude +01581,Westboro,1,42.2679,-71.6176 +01730,Bedford,1,42.4843,-71.2768 +01833,Georgetown,1,42.7281,-70.9822 +02116,Boston,1,42.3492,-71.0768 +02139,Cambridge,1,42.3647,-71.1042 +02184,Braintree,1,42.2093,-70.9963 +02903,Providence,1,41.82,-71.4158 +03049,Hollis,3,42.7485,-71.5772 +03801,Portsmouth,3,43.0729,-70.8052 +06897,Wilton,1,41.2018,-73.4383 +07960,Morristown,1,40.7952,-74.4873 +08837,Edison,1,40.5325,-74.3375 +10019,New York,1,40.7651,-73.9858 +10038,New York,1,40.7101,-74.0013 +11747,Mellvile,1,40.7946,-73.403 +14450,Fairport,1,43.0892,-77.436 +19428,Philadelphia,3,40.0825,-75.3044 +19713,Neward,1,39.6699,-75.7151 +20852,Rockville,1,39.0496,-77.1204 +27403,Greensboro,1,36.0641,-79.8202 +27511,Cary,1,35.7641,-78.7786 +29202,Columbia,4,34.0007,-81.0348 +30346,Atlanta,4,33.9267,-84.3334 +31406,Savannah,4,31.989,-81.0979 +32859,Orlando,4,28.4429,-81.4026 +33607,Tampa,4,27.9625,-82.4895 +40222,Louisville,1,38.2674,-85.6237 +44122,Beachwood,3,41.4701,-81.5232 +45839,Findlay,3,41.0442,-83.6499 +48075,Southfield,3,42.4638,-83.2255 +48084,Troy,3,42.5627,-83.1799 +48304,Bloomfield Hills,3,42.587,-83.2359 +53404,Racine,3,42.7433,-87.8053 +55113,Roseville,3,45.0139,-93.1571 +55439,Minneapolis,3,44.8744,-93.3753 +60179,Hoffman Estates,2,42.0793,-88.2237 +60601,Chicago,2,41.8858,-87.6181 +72716,Bentonville,4,36.3729,-94.2088 +75234,Dallas,4,32.9245,-96.8938 +78759,Austin,4,30.4036,-97.7526 +80202,Denver,2,39.7491,-104.9946 +80909,Colorado Springs,2,38.852,-104.7735 +85014,Phoenix,2,33.5103,-112.0556 +85251,Scottsdale,2,33.4936,-111.9167 +90405,Santa Monica,2,34.01,-118.4717 +94025,Menlo Park,2,37.4396,-122.1864 +94105,San Francisco,2,37.7864,-122.3892 +95008,Campbell,2,37.2803,-121.9539 +95054,Santa Clara,2,37.3924,-121.9623 +95060,Santa Cruz,2,37.0313,-122.1198 +98004,Bellevue,2,47.6155,-122.2072 +98052,Redmond,2,47.6718,-122.1232 +98104,Seattle,2,47.6036,-122.3256 diff --git a/demo/northwind-traders/install.sh b/demo/northwind-traders/install.sh index 3f369ca..6794a5c 100755 --- a/demo/northwind-traders/install.sh +++ b/demo/northwind-traders/install.sh @@ -25,20 +25,12 @@ make-public.sh -b "$base" -f "$cert_pem_file" -p "$cert_password" --proxy "$prox cd admin/model -printf "\n### Import ontologies\n\n" +printf "\n### Importing namespace ontology\n\n" -./import-ontologies.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" - -printf "\n### Adding ontology import\n\n" - -./add-imports.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" - -printf "\n### Clearing ontologies\n\n" +./import-ns.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" cd .. -./clear-ontologies.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" - cd .. printf "\n### Creating containers\n\n" diff --git a/demo/northwind-traders/queries/imports/territories.rq b/demo/northwind-traders/queries/imports/territories.rq index 9be7315..25c3ddf 100644 --- a/demo/northwind-traders/queries/imports/territories.rq +++ b/demo/northwind-traders/queries/imports/territories.rq @@ -1,6 +1,7 @@ PREFIX foaf: PREFIX dct: PREFIX schema: +PREFIX geo: CONSTRUCT { @@ -13,14 +14,18 @@ CONSTRUCT dct:title ?territoryDescription ; schema:name ?territoryDescription ; schema:identifier ?territoryID ; - schema:containedInPlace ?region . + schema:containedInPlace ?region ; + geo:lat ?latitude ; + geo:long ?longitude . } } WHERE { ?territory_row <#territoryID> ?territoryID ; <#territoryDescription> ?territoryDescription ; - <#regionID> ?regionID . + <#regionID> ?regionID ; + <#latitude> ?latitude ; + <#longitude> ?longitude . BIND(uri(concat(str($base), "territories/")) AS ?container) BIND(uri(concat(str(?container), encode_for_uri(?territoryID), "/")) AS ?graph) diff --git a/demo/skos/admin/clear-ontologies.sh b/demo/skos/admin/clear-ontologies.sh deleted file mode 100755 index 04f0ef8..0000000 --- a/demo/skos/admin/clear-ontologies.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then - echo "Usage: $0" '$base $cert_pem_file $cert_password [$proxy]' >&2 - echo "Example: $0" 'https://localhost:4443/admin/ ../../../../ssl/owner/cert.pem Password [https://localhost:5443/]' >&2 - echo "Note: special characters such as $ need to be escaped in passwords!" >&2 - exit 1 -fi - -base="$1" -cert_pem_file="$(realpath $2)" -cert_password="$3" - -if [ -n "$4" ]; then - proxy="$4" -else - proxy="$base" -fi - -clear-ontology.sh \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - -b "${base}admin/" \ - --proxy "$proxy" \ - --ontology "${base}ns#" diff --git a/demo/skos/admin/model/add-constraints.sh b/demo/skos/admin/model/add-constraints.sh deleted file mode 100755 index 1817060..0000000 --- a/demo/skos/admin/model/add-constraints.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env bash - -if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then - echo "Usage: $0" '$base $cert_pem_file $cert_password [$proxy]' >&2 - echo "Example: $0" 'https://localhost:4443/ ../../../../../ssl/owner/cert.pem Password [https://localhost:5443/]' >&2 - echo "Note: special characters such as $ need to be escaped in passwords!" >&2 - exit 1 -fi - -base="$1" -cert_pem_file=$(realpath "$2") -cert_password="$3" - -if [ -n "$4" ]; then - proxy="$4" -else - proxy="$base" -fi - -add-property-constraint.sh \ - -b "${base}admin/" \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$proxy" \ - --uri "${base}ns#MissingPrefLabel" \ - --label "Missing skos:prefLabel" \ - --property "http://www.w3.org/2004/02/skos/core#prefLabel" \ - "${base}admin/ontologies/namespace/" diff --git a/demo/skos/admin/model/collection-template.ttl b/demo/skos/admin/model/collection-template.ttl deleted file mode 100644 index 9954f41..0000000 --- a/demo/skos/admin/model/collection-template.ttl +++ /dev/null @@ -1,34 +0,0 @@ -@prefix : <#> . -@prefix ldh: . -@prefix rdfs: . -@prefix sp: . -@prefix spin: . -@prefix dct: . -@prefix skos: . - -skos:Collection ldh:template <../../../ns#CollectionMembers>. - -<../../../ns#CollectionMembers> a ldh:View ; - dct:title "Collection members" ; - spin:query <../../../ns#SelectCollectionMembers> ; - rdfs:isDefinedBy <../../../ns#> . - -<../../../ns#SelectCollectionMembers> a sp:Select ; - rdfs:label "Select collection members" ; - sp:text """ -PREFIX skos: - -SELECT DISTINCT ?member -WHERE - { GRAPH ?graph - { $about skos:member ?member . - GRAPH ?memberGraph - { - ?member skos:prefLabel ?prefLabel . - FILTER (langMatches(lang(?prefLabel), "en")) - } - } - } -ORDER BY ?prefLabel -""" ; - rdfs:isDefinedBy <../../../ns#> . diff --git a/demo/skos/admin/model/concept-scheme-template.ttl b/demo/skos/admin/model/concept-scheme-template.ttl deleted file mode 100644 index 286a49b..0000000 --- a/demo/skos/admin/model/concept-scheme-template.ttl +++ /dev/null @@ -1,31 +0,0 @@ -@prefix : <#> . -@prefix ldh: . -@prefix rdfs: . -@prefix sp: . -@prefix spin: . -@prefix dct: . -@prefix skos: . - -skos:ConceptScheme ldh:template <../../../ns#ConceptsInScheme>. - -<../../../ns#ConceptsInScheme> a ldh:View ; - dct:title "Concepts in scheme" ; - spin:query <../../../ns#SelectConceptsInScheme> ; - rdfs:isDefinedBy <../../../ns#> . - -<../../../ns#SelectConceptsInScheme> a sp:Select ; - rdfs:label "Select concepts in scheme" ; - sp:text """ -PREFIX skos: - -SELECT DISTINCT ?concept -WHERE - { GRAPH ?graph - { ?concept skos:inScheme $about ; - skos:prefLabel ?prefLabel . - FILTER (langMatches(lang(?prefLabel), "en")) - } - } -ORDER BY ?prefLabel -""" ; - rdfs:isDefinedBy <../../../ns#> . diff --git a/demo/skos/admin/model/concept-template.ttl b/demo/skos/admin/model/concept-template.ttl deleted file mode 100644 index 28f576a..0000000 --- a/demo/skos/admin/model/concept-template.ttl +++ /dev/null @@ -1,66 +0,0 @@ -@prefix : <#> . -@prefix ldh: . -@prefix rdfs: . -@prefix sp: . -@prefix spin: . -@prefix dct: . -@prefix skos: . - -# narrower - -skos:Concept ldh:template <../../../ns#NarrowerConcepts>. - -<../../../ns#NarrowerConcepts> a ldh:View ; - dct:title "Narrower concepts" ; - spin:query <../../../ns#SelectNarrowerConcepts> ; - rdfs:isDefinedBy <../../../ns#> . - -<../../../ns#SelectNarrowerConcepts> a sp:Select ; - rdfs:label "Select narrower concepts" ; - sp:text """ -PREFIX skos: - -SELECT DISTINCT ?narrower -WHERE - { GRAPH ?graph - { $about skos:narrower ?narrower . - GRAPH ?narrowerGraph - { - ?narrower skos:prefLabel ?prefLabel . - FILTER (langMatches(lang(?prefLabel), "en")) - } - } - } -ORDER BY ?prefLabel -""" ; - rdfs:isDefinedBy <../../../ns#> . - -# broader - -skos:Concept ldh:template <../../../ns#BroaderConcepts>. - -<../../../ns#BroaderConcepts> a ldh:View ; - dct:title "Broader concepts" ; - spin:query <../../../ns#SelectBroaderConcepts> ; - rdfs:isDefinedBy <../../../ns#> . - -<../../../ns#SelectBroaderConcepts> a sp:Select ; - rdfs:label "Select broader concepts" ; - sp:text """ -PREFIX skos: - -SELECT DISTINCT ?broader -WHERE - { GRAPH ?graph - { $about skos:broader ?broader . - GRAPH ?broaderGraph - { - ?broader skos:prefLabel ?prefLabel . - FILTER (langMatches(lang(?prefLabel), "en")) - } - } - } -ORDER BY ?prefLabel -""" ; - rdfs:isDefinedBy <../../../ns#> . - diff --git a/demo/skos/admin/model/import-ontologies.sh b/demo/skos/admin/model/import-ontologies.sh deleted file mode 100755 index e9ea9d9..0000000 --- a/demo/skos/admin/model/import-ontologies.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env bash - -if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then - echo "Usage: $0" '$base $cert_pem_file $cert_password [$proxy]' >&2 - echo "Example: $0" 'https://localhost:4443/demo/skos/ ../../../../../ssl/owner/cert.pem Password [https://localhost:5443/]' >&2 - echo "Note: special characters such as $ need to be escaped in passwords!" >&2 - exit 1 -fi - -base="$1" -cert_pem_file=$(realpath "$2") -cert_password="$3" - -if [ -n "$4" ]; then - proxy="$4" -else - proxy="$base" -fi - -skos_doc=$(create-item.sh \ - -b "${base}admin/" \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$proxy" \ - --title "SKOS" \ - --slug "skos" \ - --container "${base}admin/ontologies/" -) - -import-ontology.sh \ - -b "${base}admin/" \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$proxy" \ - --source "http://www.w3.org/2004/02/skos/core" \ - --graph "$skos_doc" - -add-ontology-import.sh \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$proxy" \ - --import "http://www.w3.org/2004/02/skos/core" \ - "${base}admin/ontologies/namespace/" diff --git a/demo/skos/admin/model/post-class-templates.sh b/demo/skos/admin/model/post-class-templates.sh deleted file mode 100755 index 3a3b33d..0000000 --- a/demo/skos/admin/model/post-class-templates.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env bash - -if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then - echo "Usage: $0" '$base $cert_pem_file $cert_password [$proxy]' >&2 - echo "Example: $0" 'https://localhost:4443/ ../../../../../ssl/owner/cert.pem Password [https://localhost:5443/]' >&2 - echo "Note: special characters such as $ need to be escaped in passwords!" >&2 - exit 1 -fi - -base="$1" -cert_pem_file=$(realpath "$2") -cert_password="$3" - -if [ -n "$4" ]; then - proxy="$4" -else - proxy="$base" -fi - -# clear the old contents of the namespace ontology - -{ echo "BASE <${base}admin/ontologies/namespace/>"; cat patch-ontology.ru; } | patch.sh \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$proxy" \ - "${base}admin/ontologies/namespace/" - -# append the new class templates to the namespace ontology - -cat concept-template.ttl | post.sh \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$proxy" \ - --content-type "text/turtle" \ - "${base}admin/ontologies/namespace/" - -cat collection-template.ttl | post.sh \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$proxy" \ - --content-type "text/turtle" \ - "${base}admin/ontologies/namespace/" - -cat concept-scheme-template.ttl | post.sh \ - -f "$cert_pem_file" \ - -p "$cert_password" \ - --proxy "$proxy" \ - --content-type "text/turtle" \ - "${base}admin/ontologies/namespace/" diff --git a/demo/skos/root.ttl b/demo/skos/root.ttl deleted file mode 100644 index 9866c9e..0000000 --- a/demo/skos/root.ttl +++ /dev/null @@ -1,24 +0,0 @@ -@prefix def: . -@prefix ldh: . -@prefix rdf: . -@prefix xsd: . -@prefix dh: . -@prefix dct: . -@prefix sioc: . - -<> a def:Root ; - dct:title "SKOS" ; - dct:description "SKOS-based editor of thesauri, lexicons, vocabularies, taxonomies, and classification schemes" ; - rdf:_1 <#page-header> ; - rdf:_2 <#select-children> . - -<#page-header> a ldh:XHTML ; - rdf:value """
- -
"""^^rdf:XMLLiteral . - -<#select-children> a ldh:Object ; - rdf:value ldh:ChildrenView . diff --git a/demo/skos/Makefile b/demo/unesco-thesaurus/Makefile similarity index 100% rename from demo/skos/Makefile rename to demo/unesco-thesaurus/Makefile diff --git a/demo/skos/admin/acl/create-authorizations.sh b/demo/unesco-thesaurus/admin/acl/create-authorizations.sh similarity index 72% rename from demo/skos/admin/acl/create-authorizations.sh rename to demo/unesco-thesaurus/admin/acl/create-authorizations.sh index f7773f3..bee09a0 100755 --- a/demo/skos/admin/acl/create-authorizations.sh +++ b/demo/unesco-thesaurus/admin/acl/create-authorizations.sh @@ -7,6 +7,11 @@ if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then exit 1 fi +admin_uri() { + local uri="$1" + echo "$uri" | sed 's|://|://admin.|' +} + base="$1" cert_pem_file=$(realpath "$2") cert_password="$3" @@ -17,25 +22,28 @@ else proxy="$base" fi +admin_base=$(admin_uri "$base") +admin_proxy=$(admin_uri "$proxy") + pwd=$(realpath "$PWD") -sha1sum=$(sha1sum "$pwd"/../../files/skos.xsl | cut -d ' ' -f 1) +sha1sum=$(sha1sum "$pwd"/../../files/layout.xsl | cut -d ' ' -f 1) create-authorization.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ - --label "Public SKOS XSLT stylesheet" \ + --proxy "$admin_proxy" \ + --label "Public layout XSLT stylesheet" \ --agent-class http://xmlns.com/foaf/0.1/Agent \ --to "${base}uploads/${sha1sum}/" \ --read create-authorization.sh \ - -b "${base}admin/" \ + -b "$admin_base" \ -f "$cert_pem_file" \ -p "$cert_password" \ - --proxy "$proxy" \ + --proxy "$admin_proxy" \ --label "Read access to graph items" \ --agent-class "http://www.w3.org/ns/auth/acl#AuthenticatedAgent" \ --to-all-in "https://www.w3.org/ns/ldt/document-hierarchy#Item" \ diff --git a/demo/unesco-thesaurus/admin/model/import-ns.sh b/demo/unesco-thesaurus/admin/model/import-ns.sh new file mode 100755 index 0000000..736cd02 --- /dev/null +++ b/demo/unesco-thesaurus/admin/model/import-ns.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash + +if [ "$#" -ne 3 ] && [ "$#" -ne 4 ]; then + echo "Usage: $0" '$base $cert_pem_file $cert_password [$proxy]' >&2 + echo "Example: $0" 'https://localhost:4443/ ../../../../../ssl/owner/cert.pem Password [https://localhost:5443/]' >&2 + echo "Note: special characters such as $ need to be escaped in passwords!" >&2 + exit 1 +fi + +base="$1" +cert_pem_file=$(realpath "$2") +cert_password="$3" + +if [ -n "$4" ]; then + proxy="$4" +else + proxy="$base" +fi + +admin_uri() { + local uri="$1" + echo "$uri" | sed 's|://|://admin.|' +} + +admin_base=$(admin_uri "$base") +admin_proxy=$(admin_uri "$proxy") + +# create a new document for the SKOS ontology + +target=$(create-item.sh \ + -b "$admin_base" \ + -f "$cert_pem_file" \ + -p "$cert_password" \ + --proxy "$admin_proxy" \ + --title "SKOS" \ + --slug "skos" \ + --container "${admin_base}ontologies/" +) + +# import the SKOS ontology data + +import-ontology.sh \ + -b "$admin_base" \ + -f "$cert_pem_file" \ + -p "$cert_password" \ + --proxy "$admin_proxy" \ + --source "http://www.w3.org/2004/02/skos/core" \ + --graph "$target" + +# clear the old properties of the namespace ontology + +{ echo "BASE <${admin_base}ontologies/namespace/>"; cat patch-ontology.ru; } | patch.sh \ + -f "$cert_pem_file" \ + -p "$cert_password" \ + --proxy "$admin_proxy" \ + "${admin_base}ontologies/namespace/" + +# append the ns.ttl file to the namespace ontology +# prepend @base directive using end-user base URI so that the : prefix +# (defined as in ns.ttl) resolves to the end-user namespace + +{ echo "@base <${base}ns> ."; cat ns.ttl; } | post.sh \ + -f "$cert_pem_file" \ + -p "$cert_password" \ + --proxy "$admin_proxy" \ + --content-type "text/turtle" \ + "${admin_base}ontologies/namespace/" + +clear-ontology.sh \ + -f "$cert_pem_file" \ + -p "$cert_password" \ + -b "$admin_base" \ + --proxy "$admin_proxy" \ + --ontology "${base}ns#" diff --git a/demo/unesco-thesaurus/admin/model/ns.ttl b/demo/unesco-thesaurus/admin/model/ns.ttl new file mode 100644 index 0000000..580e638 --- /dev/null +++ b/demo/unesco-thesaurus/admin/model/ns.ttl @@ -0,0 +1,134 @@ +@prefix : <#> . +@prefix owl: . +@prefix ldh: . +@prefix rdfs: . +@prefix sp: . +@prefix spin: . +@prefix dct: . +@prefix skos: . + +: a owl:Ontology ; + owl:imports . + +# Concept + +skos:Concept spin:constraint :MissingPrefLabel . + +# narrower + +skos:Concept ldh:template :NarrowerConcepts. + +:NarrowerConcepts a ldh:View ; + dct:title "Narrower concepts" ; + spin:query :SelectNarrowerConcepts ; + rdfs:isDefinedBy : . + +:SelectNarrowerConcepts a sp:Select ; + rdfs:label "Select narrower concepts" ; + sp:text """ +PREFIX skos: + +SELECT DISTINCT ?narrower +WHERE + { GRAPH ?graph + { $about skos:narrower ?narrower . + GRAPH ?narrowerGraph + { + ?narrower skos:prefLabel ?prefLabel . + FILTER (langMatches(lang(?prefLabel), "en")) + } + } + } +ORDER BY ?prefLabel +""" ; + rdfs:isDefinedBy : . + +# broader + +skos:Concept ldh:template :BroaderConcepts. + +:BroaderConcepts a ldh:View ; + dct:title "Broader concepts" ; + spin:query :SelectBroaderConcepts ; + rdfs:isDefinedBy : . + +:SelectBroaderConcepts a sp:Select ; + rdfs:label "Select broader concepts" ; + sp:text """ +PREFIX skos: + +SELECT DISTINCT ?broader +WHERE + { GRAPH ?graph + { $about skos:broader ?broader . + GRAPH ?broaderGraph + { + ?broader skos:prefLabel ?prefLabel . + FILTER (langMatches(lang(?prefLabel), "en")) + } + } + } +ORDER BY ?prefLabel +""" ; + rdfs:isDefinedBy : . + +# Collection + +skos:Collection ldh:template :CollectionMembers. + +:CollectionMembers a ldh:View ; + dct:title "Collection members" ; + spin:query :SelectCollectionMembers ; + rdfs:isDefinedBy : . + +:SelectCollectionMembers a sp:Select ; + rdfs:label "Select collection members" ; + sp:text """ +PREFIX skos: + +SELECT DISTINCT ?member +WHERE + { GRAPH ?graph + { $about skos:member ?member . + GRAPH ?memberGraph + { + ?member skos:prefLabel ?prefLabel . + FILTER (langMatches(lang(?prefLabel), "en")) + } + } + } +ORDER BY ?prefLabel +""" ; + rdfs:isDefinedBy : . + +# ConceptScheme + +skos:ConceptScheme ldh:template :ConceptsInScheme. + +:ConceptsInScheme a ldh:View ; + dct:title "Concepts in scheme" ; + spin:query :SelectConceptsInScheme ; + rdfs:isDefinedBy : . + +:SelectConceptsInScheme a sp:Select ; + rdfs:label "Select concepts in scheme" ; + sp:text """ +PREFIX skos: + +SELECT DISTINCT ?concept +WHERE + { GRAPH ?graph + { ?concept skos:inScheme $about ; + skos:prefLabel ?prefLabel . + FILTER (langMatches(lang(?prefLabel), "en")) + } + } +ORDER BY ?prefLabel +""" ; + rdfs:isDefinedBy : . + +# Constraints + +:MissingPrefLabel a ldh:MissingPropertyValue ; + rdfs:label "Missing skos:prefLabel" ; + sp:arg1 skos:prefLabel . diff --git a/demo/unesco-thesaurus/admin/model/patch-ontology.ru b/demo/unesco-thesaurus/admin/model/patch-ontology.ru new file mode 100644 index 0000000..efa41e4 --- /dev/null +++ b/demo/unesco-thesaurus/admin/model/patch-ontology.ru @@ -0,0 +1,19 @@ +PREFIX foaf: + +DELETE { + ?s ?p ?o +} +WHERE { + ?s ?p ?o + # Exclude triples about the main resource itself + MINUS { + <> ?p ?o + BIND(<> AS ?s) + } + # Exclude triples about the foaf:primaryTopic resource + MINUS { + <> foaf:primaryTopic ?primaryTopic . + ?primaryTopic ?p ?o + BIND(?primaryTopic AS ?s) + } +} diff --git a/demo/skos/create-containers.sh b/demo/unesco-thesaurus/create-containers.sh similarity index 93% rename from demo/skos/create-containers.sh rename to demo/unesco-thesaurus/create-containers.sh index 2b42c60..5efe413 100755 --- a/demo/skos/create-containers.sh +++ b/demo/unesco-thesaurus/create-containers.sh @@ -45,7 +45,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select concepts" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "${pwd}/queries/select-concepts.rq" \ "$container" @@ -56,18 +56,20 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ "$container" object_id="select-concepts" +echo "AAAA" + add-object-block.sh \ -b "$base" \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" @@ -97,7 +99,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select collections" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "${pwd}/queries/select-collections.rq" \ "$container" @@ -108,7 +110,7 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ "$container" @@ -119,7 +121,7 @@ add-object-block.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" @@ -149,7 +151,7 @@ add-select.sh \ -p "$cert_password" \ --proxy "$proxy" \ --title "Select concept schemes" \ - --fragment "$query_id" \ + --uri "#${query_id}" \ --query-file "${pwd}/queries/select-concept-schemes.rq" \ "$container" @@ -160,7 +162,7 @@ add-view.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$view_id" \ + --uri "#${view_id}" \ --query "${container}#${query_id}" \ "$container" @@ -171,6 +173,6 @@ add-object-block.sh \ -f "$cert_pem_file" \ -p "$cert_password" \ --proxy "$proxy" \ - --fragment "$object_id" \ + --uri "#${object_id}" \ --value "${container}#${view_id}" \ "$container" diff --git a/demo/skos/files/bootstrap.min.css b/demo/unesco-thesaurus/files/bootstrap.min.css similarity index 100% rename from demo/skos/files/bootstrap.min.css rename to demo/unesco-thesaurus/files/bootstrap.min.css diff --git a/demo/skos/files/skos.xsl b/demo/unesco-thesaurus/files/layout.xsl similarity index 98% rename from demo/skos/files/skos.xsl rename to demo/unesco-thesaurus/files/layout.xsl index 8c50e9f..bea9ee2 100644 --- a/demo/skos/files/skos.xsl +++ b/demo/unesco-thesaurus/files/layout.xsl @@ -56,6 +56,6 @@ exclude-result-prefixes="#all"> - + \ No newline at end of file diff --git a/demo/skos/files/unesco-thesaurus.ttl b/demo/unesco-thesaurus/files/unesco-thesaurus.ttl similarity index 100% rename from demo/skos/files/unesco-thesaurus.ttl rename to demo/unesco-thesaurus/files/unesco-thesaurus.ttl diff --git a/demo/unesco-thesaurus/files/unesco.png b/demo/unesco-thesaurus/files/unesco.png new file mode 100644 index 0000000..d250e19 Binary files /dev/null and b/demo/unesco-thesaurus/files/unesco.png differ diff --git a/demo/skos/import-rdf.sh b/demo/unesco-thesaurus/import-rdf.sh similarity index 100% rename from demo/skos/import-rdf.sh rename to demo/unesco-thesaurus/import-rdf.sh diff --git a/demo/skos/install.sh b/demo/unesco-thesaurus/install.sh similarity index 74% rename from demo/skos/install.sh rename to demo/unesco-thesaurus/install.sh index 5af00eb..50f82bc 100755 --- a/demo/skos/install.sh +++ b/demo/unesco-thesaurus/install.sh @@ -33,24 +33,12 @@ cd .. cd model -printf "\n### Import ontologies\n\n" +printf "\n### Importing namespace ontology\n\n" -./import-ontologies.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" - -printf "\n### Creating constraints\n\n" - -./add-constraints.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" - -printf "\n### Creating block templates\n\n" - -./post-class-templates.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" +./import-ns.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" cd .. -printf "\n### Clearing ontologies\n\n" - -./clear-ontologies.sh "$base" "$cert_pem_file" "$cert_password" "$proxy" - cd .. printf "\n### Uploading files\n\n" diff --git a/demo/skos/queries/select-collections.rq b/demo/unesco-thesaurus/queries/select-collections.rq similarity index 100% rename from demo/skos/queries/select-collections.rq rename to demo/unesco-thesaurus/queries/select-collections.rq diff --git a/demo/skos/queries/select-concept-schemes.rq b/demo/unesco-thesaurus/queries/select-concept-schemes.rq similarity index 100% rename from demo/skos/queries/select-concept-schemes.rq rename to demo/unesco-thesaurus/queries/select-concept-schemes.rq diff --git a/demo/skos/queries/select-concepts.rq b/demo/unesco-thesaurus/queries/select-concepts.rq similarity index 100% rename from demo/skos/queries/select-concepts.rq rename to demo/unesco-thesaurus/queries/select-concepts.rq diff --git a/demo/skos/queries/skos-import.rq b/demo/unesco-thesaurus/queries/skos-import.rq similarity index 100% rename from demo/skos/queries/skos-import.rq rename to demo/unesco-thesaurus/queries/skos-import.rq diff --git a/demo/unesco-thesaurus/root.ttl b/demo/unesco-thesaurus/root.ttl new file mode 100644 index 0000000..3cad425 --- /dev/null +++ b/demo/unesco-thesaurus/root.ttl @@ -0,0 +1,41 @@ +@prefix def: . +@prefix ldh: . +@prefix rdf: . +@prefix xsd: . +@prefix dh: . +@prefix dct: . +@prefix sioc: . + +<> a def:Root ; + dct:title "Unesco Thesaurus" ; + dct:description "SKOS-based editor of thesauri, lexicons, vocabularies, taxonomies, and classification schemes" ; + rdf:_1 <#page-header> ; + rdf:_2 <#select-children> . + +<#page-header> a ldh:XHTML ; + rdf:value """
+ +
+
+

This application demonstrates the capabilities of LinkedDataHub's SKOS package.

+
+
Browser
+
Navigate concepts, collections, and concept schemes with parallax navigation through broader/narrower/related relationships
+
Editor
+
Create and edit SKOS resources (requires authentication)
+
RDF Import
+
Import data using SPARQL transformation queries
+
+
+
+ + UNESCO Thesaurus + +
+
+
"""^^rdf:XMLLiteral . + +<#select-children> a ldh:Object ; + rdf:value ldh:ChildrenView . diff --git a/demo/skos/screenshot-edit-mode.png b/demo/unesco-thesaurus/screenshot-edit-mode.png similarity index 100% rename from demo/skos/screenshot-edit-mode.png rename to demo/unesco-thesaurus/screenshot-edit-mode.png diff --git a/demo/skos/screenshot.png b/demo/unesco-thesaurus/screenshot.png similarity index 100% rename from demo/skos/screenshot.png rename to demo/unesco-thesaurus/screenshot.png diff --git a/demo/skos/update-documents.sh b/demo/unesco-thesaurus/update-documents.sh similarity index 100% rename from demo/skos/update-documents.sh rename to demo/unesco-thesaurus/update-documents.sh diff --git a/demo/skos/upload-file.sh b/demo/unesco-thesaurus/upload-file.sh similarity index 100% rename from demo/skos/upload-file.sh rename to demo/unesco-thesaurus/upload-file.sh diff --git a/demo/skos/validate-documents.sh b/demo/unesco-thesaurus/validate-documents.sh similarity index 100% rename from demo/skos/validate-documents.sh rename to demo/unesco-thesaurus/validate-documents.sh diff --git a/linkeddatahub/docs/reference/administration.ttl b/linkeddatahub/docs/reference/administration.ttl index abb81c1..ea3022f 100644 --- a/linkeddatahub/docs/reference/administration.ttl +++ b/linkeddatahub/docs/reference/administration.ttl @@ -17,7 +17,7 @@ <#content> a ldh:XHTML ; rdf:value """

Access control and domain model management

-

Administration is provided in a separate LDT application, which is paired with each end-user +

Administration is provided in a separate LinkedDataHub application, which is paired with each end-user application.

"""^^rdf:XMLLiteral . diff --git a/linkeddatahub/docs/reference/stylesheets.ttl b/linkeddatahub/docs/reference/stylesheets.ttl index 67ff584..9c834fe 100644 --- a/linkeddatahub/docs/reference/stylesheets.ttl +++ b/linkeddatahub/docs/reference/stylesheets.ttl @@ -117,8 +117,8 @@ lapp: https://w3id.org/atomgraph/linkeddatahub/apps# - AtomGraph Platform - LDT application concepts + LinkedDataHub application ontology + LinkedDataHub application concepts lacl: @@ -150,7 +150,7 @@
$ac:forClass
The URI of the class whose instance is being created.
$lapp:Application
-
RDF/XML document with the metadata of the current LDT application
+
RDF/XML document with the metadata of the current LinkedDataHub application
$foaf:Agent
RDF/XML document with the metadata of the currently authenticated agent (if any)
diff --git a/packages/README.md b/packages/README.md new file mode 100644 index 0000000..8d43117 --- /dev/null +++ b/packages/README.md @@ -0,0 +1,233 @@ +# LinkedDataHub Packages + +This directory contains reusable packages for LinkedDataHub dataspaces. Packages provide vocabulary support with custom ontologies and XSLT templates for rendering specific RDF vocabularies. + +## Package Structure + +Each package consists of: + +``` +packages// +├── package.ttl # Package metadata (ldhp:Package resource) +├── ns.ttl # Ontology with template blocks (ldh:template) +└── layout.xsl # XSLT stylesheet with custom templates +``` + +### Example: SKOS Package + +``` +packages/skos/ +├── package.ttl # Metadata: https://packages.linkeddatahub.com/skos/#this +├── ns.ttl # SKOS vocabulary with ldh:template blocks +└── layout.xsl # XSLT templates for SKOS concepts, schemes, collections +``` + +## How Packages Work + +### 1. Package Metadata (`package.ttl`) + +Describes the package using standard LinkedDataHub properties: + +```turtle +@prefix ldhp: . +@prefix ldt: . +@prefix ac: . + + a ldhp:Package ; + rdfs:label "SKOS Package" ; + dct:description "SKOS vocabulary support with custom templates" ; + ldt:ontology ; + ac:stylesheet . +``` + +**Note**: Uses standard `ldt:ontology` and `ac:stylesheet` properties instead of inventing new ones. + +### 2. Ontology (`ns.ttl`) + +Contains two layers: + +**A. RDF Vocabulary Classes and Properties** +```turtle +skos:Concept a owl:Class ; + rdfs:label "Concept" . + +skos:narrower a owl:ObjectProperty ; + rdfs:label "has narrower" . +``` + +**B. Template Blocks (ldh:template)** + +SPARQL-based views attached to RDF types: + +```turtle +skos:Concept ldh:template ns:NarrowerConcepts . + +ns:NarrowerConcepts a ldh:View ; + dct:title "Narrower concepts" ; + spin:query ns:SelectNarrowerConcepts . + +ns:SelectNarrowerConcepts a sp:Select ; + sp:text """ + SELECT DISTINCT ?narrower + WHERE { GRAPH ?graph { $about skos:narrower ?narrower } } + ORDER BY ?narrower + """ . +``` + +### 3. XSLT Stylesheet (`layout.xsl`) + +XSLT templates using `bs2:*` modes to override default rendering: + +```xsl + + + + + + + +``` + +## Installing Packages + +### Method 1: CLI Script + +```bash +install-package.sh \ + -b https://localhost:4443/ \ + -f ssl/owner/cert.pem \ + -p Password \ + --package https://packages.linkeddatahub.com/skos/#this +``` + +### Method 2: From Application Install Script + +```bash +# In LinkedDataHub-Apps/demo/skos/install.sh +install-package.sh \ + -b "$base" \ + -f "$cert_pem_file" \ + -p "$cert_password" \ + --package "https://packages.linkeddatahub.com/skos/#this" +``` + +## Prerequisites + +Before installing packages, a **master stylesheet** must exist at `/static//layout.xsl` in the webapp directory. A default template is provided at: + +``` +src/main/webapp/static/localhost/layout.xsl +``` + +This file should be deployed with the application. It contains: + +```xml + + + + + + + + + +``` + +## What Installation Does + +When you install a package, the system: + +1. **Fetches package metadata** from the package URI +2. **Downloads package ontology** (`ns.ttl`) and POSTs it to the namespace graph (`${admin_base}ontologies/namespace/`) +3. **Downloads package stylesheet** (`layout.xsl`) and saves it to `/static/packages//layout.xsl` +4. **Updates master stylesheet** at `/static//layout.xsl` by adding import: + ```xml + + + ``` +5. **Adds import to application** (currently manual): ` ldh:import ` + +**Note**: The master stylesheet must already exist or installation will fail with `InternalServerErrorException`. + +## Architecture + +### Installation-Time vs Runtime + +Packages use **installation-time composition**, NOT runtime composition: + +- ✅ Package content is integrated during installation (via JAX-RS endpoints) +- ✅ Ontology and XSLT are pre-composed before being loaded +- ✅ No runtime overhead +- ❌ No dynamic package loading at request time + +### JAX-RS Endpoints + +- **POST `/admin/install-package`** - Installs a package + - Parameter: `packageUri` (form-urlencoded) + - Requires admin authentication + +- **POST `/admin/uninstall-package`** - Uninstalls a package + - Parameter: `packageUri` (form-urlencoded) + - Requires admin authentication + +### File System Structure + +After installation: + +``` +webapp/ +├── static/ +│ ├── packages/ +│ │ └── skos/ +│ │ └── layout.xsl # Package stylesheet +│ └── localhost/ +│ └── layout.xsl # Generated master stylesheet +``` + +### SPARQL Data Structure + +```turtle +# In system.trig (application config) + a lapp:Application ; + ldt:ontology ; + ac:stylesheet ; # Master stylesheet + ldh:import . + +# In admin SPARQL endpoint (namespace graph) +# Contains merged package ontologies via owl:imports +``` + +## Available Packages + +- **skos** - SKOS vocabulary support (concepts, schemes, collections) + +## Creating New Packages + +1. Create directory: `packages//` +2. Write `package.ttl` with metadata +3. Write `ns.ttl` with vocabulary and template blocks +4. Write `layout.xsl` with XSLT templates (using `bs2:*` modes) +5. Publish as Linked Data at `https://packages.linkeddatahub.com//#this` + +## Vocabulary Reference + +### LDHP Vocabulary (`https://w3id.org/atomgraph/linkeddatahub/package#`) + +- `ldhp:Package` - Package class + +### Standard Properties (Reused) + +- `ldt:ontology` - Points to package ontology URI (from LDT vocabulary) +- `ac:stylesheet` - Points to package stylesheet URI (from AtomGraph Client vocabulary) +- `ldh:import` - Application property linking to imported packages (from LDH vocabulary) + +## Notes + +- Packages are **declarative only** (RDF + XSLT, no Java code) +- Package ontologies use `owl:imports` (handled automatically by Jena) +- Package stylesheets use `xsl:import` (handled by master stylesheet generation) +- Template blocks (`ldh:template`) are separate from XSLT overrides +- Both mechanisms work independently and complement each other diff --git a/packages/skos/layout.xsl b/packages/skos/layout.xsl new file mode 100644 index 0000000..bea9ee2 --- /dev/null +++ b/packages/skos/layout.xsl @@ -0,0 +1,61 @@ + + + + + + + + + +]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/packages/skos/ns.ttl b/packages/skos/ns.ttl new file mode 100644 index 0000000..3f1f5ec --- /dev/null +++ b/packages/skos/ns.ttl @@ -0,0 +1,131 @@ +@prefix : <#> . +@prefix ns: . +@prefix ldh: . +@prefix rdfs: . +@prefix sp: . +@prefix spin: . +@prefix dct: . +@prefix skos: . + +# Concept + +skos:Concept spin:constraint ns:MissingPrefLabel . + +# narrower + +skos:Concept ldh:template ns:NarrowerConcepts. + +ns:NarrowerConcepts a ldh:View ; + dct:title "Narrower concepts" ; + spin:query ns:SelectNarrowerConcepts ; + rdfs:isDefinedBy ns: . + +ns:SelectNarrowerConcepts a sp:Select ; + rdfs:label "Select narrower concepts" ; + sp:text """ +PREFIX skos: + +SELECT DISTINCT ?narrower +WHERE + { GRAPH ?graph + { $about skos:narrower ?narrower . + GRAPH ?narrowerGraph + { + ?narrower skos:prefLabel ?prefLabel . + FILTER (langMatches(lang(?prefLabel), "en")) + } + } + } +ORDER BY ?prefLabel +""" ; + rdfs:isDefinedBy ns: . + +# broader + +skos:Concept ldh:template ns:BroaderConcepts. + +ns:BroaderConcepts a ldh:View ; + dct:title "Broader concepts" ; + spin:query ns:SelectBroaderConcepts ; + rdfs:isDefinedBy ns: . + +ns:SelectBroaderConcepts a sp:Select ; + rdfs:label "Select broader concepts" ; + sp:text """ +PREFIX skos: + +SELECT DISTINCT ?broader +WHERE + { GRAPH ?graph + { $about skos:broader ?broader . + GRAPH ?broaderGraph + { + ?broader skos:prefLabel ?prefLabel . + FILTER (langMatches(lang(?prefLabel), "en")) + } + } + } +ORDER BY ?prefLabel +""" ; + rdfs:isDefinedBy ns: . + +# Collection + +skos:Collection ldh:template ns:CollectionMembers. + +ns:CollectionMembers a ldh:View ; + dct:title "Collection members" ; + spin:query ns:SelectCollectionMembers ; + rdfs:isDefinedBy ns: . + +ns:SelectCollectionMembers a sp:Select ; + rdfs:label "Select collection members" ; + sp:text """ +PREFIX skos: + +SELECT DISTINCT ?member +WHERE + { GRAPH ?graph + { $about skos:member ?member . + GRAPH ?memberGraph + { + ?member skos:prefLabel ?prefLabel . + FILTER (langMatches(lang(?prefLabel), "en")) + } + } + } +ORDER BY ?prefLabel +""" ; + rdfs:isDefinedBy ns: . + +# ConceptScheme + +skos:ConceptScheme ldh:template ns:ConceptsInScheme. + +ns:ConceptsInScheme a ldh:View ; + dct:title "Concepts in scheme" ; + spin:query ns:SelectConceptsInScheme ; + rdfs:isDefinedBy ns: . + +ns:SelectConceptsInScheme a sp:Select ; + rdfs:label "Select concepts in scheme" ; + sp:text """ +PREFIX skos: + +SELECT DISTINCT ?concept +WHERE + { GRAPH ?graph + { ?concept skos:inScheme $about ; + skos:prefLabel ?prefLabel . + FILTER (langMatches(lang(?prefLabel), "en")) + } + } +ORDER BY ?prefLabel +""" ; + rdfs:isDefinedBy ns: . + +# Constraints + +ns:MissingPrefLabel a ldh:MissingPropertyValue ; + rdfs:label "Missing skos:prefLabel" ; + sp:arg1 skos:prefLabel . diff --git a/packages/skos/package.ttl b/packages/skos/package.ttl new file mode 100644 index 0000000..2fee9d7 --- /dev/null +++ b/packages/skos/package.ttl @@ -0,0 +1,19 @@ +@prefix : <#> . +@prefix lapp: . +@prefix ldt: . +@prefix ac: . +@prefix rdfs: . +@prefix dct: . +@prefix foaf: . + + a lapp:Package ; + rdfs:label "SKOS Package" ; + dct:title "SKOS Package for LinkedDataHub" ; + dct:description "Provides SKOS (Simple Knowledge Organization System) vocabulary support with custom templates for concept hierarchies, schemes, and collections." ; + dct:creator ; + ldt:ontology ; + ac:stylesheet . + + a foaf:Organization ; + foaf:name "AtomGraph" ; + foaf:homepage .