Commits

Anonymous committed 2658308

add script to import the get capabilities of wms services

  • Participants
  • Parent commits 9d0d2f8

Comments (0)

Files changed (2)

 PREFIX dc: <http://purl.org/dc/terms/>
 PREFIX dcat: <http://www.w3.org/ns/dcat#>
-PREFIX moat: <http://moat-project.org/ns#>
 
-SELECT DISTINCT * WHERE {
+SELECT DISTINCT ?service WHERE {
   ?record dcat:dataset[
-    dcat:distribution [
-      dc:format [ 
-        moat:taggedWithTag [
-            moat:name "OGC Web Mapping Service"
-        ]
-      ];
-      dcat:accessURL ?service
-    ]
-  ]
+    dcat:distribution ?dist
+  ].
+  ?dist dcat:accessURL ?service FILTER regex(str(?service), ".*wms.*", "i")
 }

misc/wms_capabilities.sh

+#!/bin/sh
+
+if test -z "$1"; then
+    echo "Usage: $0 endpoint"
+    exit 255
+fi
+
+query_endpoint=$1/sparql/
+data_endpoint=$1/data/
+tmpdir=/tmp/wms_getcapabilities.$$
+
+if test -d $tmpdir; then
+    echo "$tmpdir exists. exiting"
+    exit 255
+fi
+
+mkdir -p $tmpdir
+
+curl -d "query=`cat wms.sparql`" -d "soft-limit=-1" $query_endpoint | \
+    grep 'binding name="service"' | \
+    sed -e 's/.*<uri>//' -e 's/<\/uri>.*//' | \
+while read cap; do
+    service=`echo $cap | sed -e 's/\?.*//'`
+    echo $service
+    ows -service=wms $service GetCapabilities > ${tmpdir}/capabilities.xml
+    if test $? -ne 0; then
+	continue
+    fi
+    xsltproc ../static/wms/capabilities.xsl ${tmpdir}/capabilities.xml | \
+	rapper -o turtle - $service > ${tmpdir}/capabilities.ttl
+    cat >> ${tmpdir}/capabilities.ttl <<EOF
+<$service> rdfs:seeAlso <$cap>.
+EOF
+    curl -X PUT -H "Content-Type: text/turtle" -T ${tmpdir}/capabilities.ttl \
+	${data_endpoint}$service 
+done
+
+rm -rf $tmpdir