diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..8fb256c --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ + +deb: + mvn -U clean install + cd linkedgeodata-debian && mvn clean install deb:package + diff --git a/bin/README.txt b/bin/README.txt deleted file mode 100644 index e259256..0000000 --- a/bin/README.txt +++ /dev/null @@ -1 +0,0 @@ -An issue with the install script might be, that Osmosis removes all indexes upon loading a dataset and only re-creates some of them when done. diff --git a/bin/bremen-latest.osm.pbf b/bin/bremen-latest.osm.pbf deleted file mode 100644 index e0df4e5..0000000 Binary files a/bin/bremen-latest.osm.pbf and /dev/null differ diff --git a/bin/config.ini.dist b/bin/config.ini.dist deleted file mode 100644 index 4168ad2..0000000 --- a/bin/config.ini.dist +++ /dev/null @@ -1,11 +0,0 @@ -dbHost="localhost" -dbName="lgd" -dbUser="postgres" -dbPass="postgres" - -# If you want to load a pbf file, set the following variable, e.g: -#osmFile=/your/path/bremen-06-03-2013.osm.pbf - -# You can find chunked OSM files here: http://download.geofabrik.de/openstreetmap/ -# Planet files are available at: http://planet.openstreetmap.org - diff --git a/bin/install-sparqlify-ubuntu.sh b/bin/install-sparqlify-ubuntu.sh deleted file mode 100755 index 4f47e10..0000000 --- a/bin/install-sparqlify-ubuntu.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -sparqlifyPath="./sparqlify-parent" -git clone git://github.com/AKSW/Sparqlify.git "$sparqlifyPath" - -cd "$sparqlifyPath" -git checkout devel - -cd sparqlify-core -mvn -U clean assembly:assembly - - diff --git a/bin/run-dump-lgd.sh b/bin/run-dump-lgd.sh deleted file mode 100755 index b2d1388..0000000 --- a/bin/run-dump-lgd.sh +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash - -# -# Dump script for LinkedGeoData: -# ./install-lgd.sh data.osm.gz -# -# -# -# - -usage="$(basename "$0") options -- program to dump a LinkedGeoData database - -where: - -h postgres host name - -d postgres database name - -u postgres user name - -p postgres password" - - -source config.ini.dist - - -#lgdBasePath="../" -sparqlifyJarFile="./sparqlify-parent/sparqlify-core/target/sparqlify-core-jar-with-dependencies.jar" - - -# Use a config.ini file to override any of the settings of this file -[ -f "./config.ini" ] && source ./config.ini - -# Simple function to echo to stderr -echoerr() { echo "$@" 1>&2; } - -# Support for simple command line args -# Source: http://mywiki.wooledge.org/BashFAQ/035#getopts -# A POSIX variable -OPTIND=1 # Reset in case getopts has been used previously in the shell. - -while getopts "?h:U:W:d:" opt; do - case "$opt" in - \?) - echoerr "$usage" - exit 0 - ;; - h) dbHost="$OPTARG" - ;; - U) dbUser="$OPTARG" - ;; - W) dbPass="$OPTARG" - ;; - d) dbName="$OPTARG" - ;; - esac -done - -shift $((OPTIND-1)) - -[ "$1" = "--" ] && shift - - -# Confirm settings before continuation -echoerr "-------------------------------------------------------------------" -echoerr "Your settings are:" -echoerr "Database" -echoerr " Name: $dbName" -echoerr " Host: $dbHost" -echoerr " Username: $dbUser" -echoerr " Password: $dbPass" - -echoerr "Paths:" -echoerr " Sparqlify path: $sparqlifyJarFile" - -echoerr "-------------------------------------------------------------------" -read -p "Press [Enter] key to start loading" - - -java -cp "$sparqlifyJarFile" org.aksw.sparqlify.web.Main -h "$dbHost" -u "$dbUser" -p "$dbPass" -d "$dbName" -m ../linkedgeodata-core/src/main/sparqlify/LinkedGeoData-Triplify-IndividualViews.sparqlify -D - - -#java -cp target/sparqlify-core-jar-with-dependencies.jar org.aksw.sparqlify.web.Main -h localhost -u postgres -p postgres -d lgd -t 10 -c ./mappings/LinkedGeoData-Triplify-IndividualViews.sparqlify -Q 'Construct { ?s ?p ?o } { ?s ?p ?o . Filter(?p = ) }' - - - - - - - diff --git a/bin/run-query-lgd.sh b/bin/run-query-lgd.sh deleted file mode 100755 index a4c601d..0000000 --- a/bin/run-query-lgd.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/bash - -# -# Dump script for LinkedGeoData: -# ./install-lgd.sh data.osm.gz -# -# -# -# - -usage="$(basename "$0") options -- program to dump a LinkedGeoData database - -where: - -h postgres host name - -d postgres database name - -u postgres user name - -p postgres password - -Q SPARQL query string" - -queryString='Construct {?s ?p ?o } {?s ?p ?o } Limit 10' - - -#lgdBasePath="../" -sparqlifyJarFile="./sparqlify-parent/sparqlify-core/target/sparqlify-core-jar-with-dependencies.jar" - -source config.ini.dist - -# Use a config.ini file to override any of the settings of this file -[ -f "./config.ini" ] && source ./config.ini - -# Simple function to echo to stderr -echoerr() { echo "$@" 1>&2; } - -# Support for simple command line args -# Source: http://mywiki.wooledge.org/BashFAQ/035#getopts -# A POSIX variable -OPTIND=1 # Reset in case getopts has been used previously in the shell. - -while getopts "?h:U:W:d:Q:" opt; do - case "$opt" in - \?) - echoerr "$usage" - exit 0 - ;; - h) dbHost="$OPTARG" - ;; - U) dbUser="$OPTARG" - ;; - W) dbPass="$OPTARG" - ;; - d) dbName="$OPTARG" - ;; - Q) queryString="$OPTARG" - ;; - - esac -done - -shift $((OPTIND-1)) - -[ "$1" = "--" ] && shift - - -# Confirm settings before continuation -echoerr "-------------------------------------------------------------------" -echoerr "Your settings are:" -echoerr "Database" -echoerr " Name: $dbName" -echoerr " Host: $dbHost" -echoerr " Username: $dbUser" -echoerr " Password: $dbPass" - -echoerr "Paths:" -echoerr " Sparqlify path: $sparqlifyJarFile" - -echoerr "-------------------------------------------------------------------" -#read -p "Press [Enter] key to start loading" - - -java -cp "$sparqlifyJarFile" org.aksw.sparqlify.web.Main -h "$dbHost" -u "$dbUser" -p "$dbPass" -d "$dbName" -m ../linkedgeodata-core/src/main/sparqlify/LinkedGeoData-Triplify-IndividualViews.sparqlify -Q "$queryString" - - -#java -cp target/sparqlify-core-jar-with-dependencies.jar org.aksw.sparqlify.web.Main -h localhost -u postgres -p postgres -d lgd -t 10 -c ./mappings/LinkedGeoData-Triplify-IndividualViews.sparqlify -Q 'Construct { ?s ?p ?o } { ?s ?p ?o . Filter(?p = ) }' - - - - - - - diff --git a/bin/test-query-a.sh b/bin/test-query-a.sh deleted file mode 100755 index 4de239a..0000000 --- a/bin/test-query-a.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -# A query for tram stops - -./run-query-lgd.sh -Q ' -Prefix ogc: -Prefix geom: -Prefix rdfs: -Prefix lgdo: -Select * { - ?a a lgdo:TramRoute . - ?a lgdo:members ?x . - ?x ?y ?z . -}' - diff --git a/bin/test-query.sh b/bin/test-query.sh deleted file mode 100755 index e558b26..0000000 --- a/bin/test-query.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -# A query for tram stops - -./run-query-lgd.sh -Q ' -Prefix ogc: -Prefix geom: -Prefix rdfs: -Prefix lgdo: -Select * { - ?a a lgdo:TramRoute . - ?a lgdo:members ?x . - ?x ?y ?z . - ?z lgdo:ref ?b . - ?b a lgdo:TramStop . - ?b rdfs:label ?l . - ?b geom:geometry ?geom . - ?geom ogc:asWKT ?geo . -}' - diff --git a/bin/uninstall-lgd-ubuntu.sh b/bin/uninstall-lgd-ubuntu.sh deleted file mode 100644 index b312e29..0000000 --- a/bin/uninstall-lgd-ubuntu.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -#Just drop the DB according to settings - YET TO BE DONE -# -#dropdb lgd -h localhost -U postgres diff --git a/linkedgeodata-cli/README.txt b/linkedgeodata-cli/README.txt new file mode 100644 index 0000000..fb18cf6 --- /dev/null +++ b/linkedgeodata-cli/README.txt @@ -0,0 +1,15 @@ +An issue with the install script might be, that Osmosis removes all indexes upon loading a dataset and only re-creates some of them when done. + + +For the deb archive: + +The scripts should read configurations by default from the following locations: + +~/.config/linkedgeodata/profiles.d/default +/etc/linkedgeodata/profiles.d/default + + +/etc/linkedgeodata/lgd.conf +profileBase[0]=~/..... +profileBase[1]=./ + diff --git a/bin/install-lgd-ubuntu.sh b/linkedgeodata-cli/bin/lgd-apt-get.sh similarity index 100% rename from bin/install-lgd-ubuntu.sh rename to linkedgeodata-cli/bin/lgd-apt-get.sh diff --git a/linkedgeodata-cli/bin/lgd-build-and-install-dependencies.sh b/linkedgeodata-cli/bin/lgd-build-and-install-dependencies.sh new file mode 100755 index 0000000..e80cdc5 --- /dev/null +++ b/linkedgeodata-cli/bin/lgd-build-and-install-dependencies.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +sparqlifyPath="/tmp/sparqlify-parent" + +echo "Building and Installing the Sparqlify Debian Package..." + +git clone git://github.com/AKSW/Sparqlify.git "$sparqlifyPath" + +cd "$sparqlifyPath" +git pull + +#git checkout devel + +make deb +debFile=`ls -1 sparqlify-debian/target/sparqlify*.deb` + +sudo dpkg -i "$debFile" + diff --git a/bin/createdb-lgd.sh b/linkedgeodata-cli/bin/lgd-createdb.sh similarity index 64% rename from bin/createdb-lgd.sh rename to linkedgeodata-cli/bin/lgd-createdb.sh index 8c2cf0d..be282ac 100755 --- a/bin/createdb-lgd.sh +++ b/linkedgeodata-cli/bin/lgd-createdb.sh @@ -13,18 +13,25 @@ where: -p password !!!will be added to ~/.pgpass if not exists!!! -f .pbf file to load (other formats currently not supported)" -source config.ini.dist - -lgdBasePath="../" -lgdSqlPath="$lgdBasePath/linkedgeodata-core/src/main/sql/" - -postgisPath="/usr/share/postgresql/9.1/contrib/postgis-2.0" +# +# Hard coded profile paths, with folder precedence order: local > home > etc +# +configFiles[0]="/etc/linkedgeodata/lgd.conf.dist" +configFiles[1]="/etc/linkedgeodata/lgd.conf" +configFiles[2]="./lgd.conf.dist" +configFiles[3]="./lgd.conf" -osmosisSqlPath="/usr/share/doc/osmosis/examples/" +for configFile in "${configFiles[@]}"; do + [ -f "$configFile" ] && source "$configFile" +done +#source config.ini.dist +#lgdSqlPath="$lgdBasePath/linkedgeodata-core/src/main/sql/" +#postgisPath="/usr/share/postgresql/9.1/contrib/postgis-2.0" +#osmosisSqlPath="/usr/share/doc/osmosis/examples/" # Use a config.ini file to override any of the settings of this file -[ -f "./config.ini" ] && source ./config.ini +#[ -f "./config.ini" ] && source ./config.ini # Simple function to echo to stderr @@ -37,6 +44,18 @@ OPTIND=1 # Reset in case getopts has been used previously in the shell. # Initialize our own variables: +#while getopts "?P:" opt; do +# case "$opt" in +# P) profileName="$OPTARG" +# ;; +# esac +#done + +#for profilePath in "${profilePaths[@]}"; do +# profileFile="$profilePath/$profileName.conf" +# [ -f "$profileFile" ] && source "$profileFile" +#done + while getopts "?h:U:W:d:f:" opt; do case "$opt" in \?) @@ -61,6 +80,7 @@ shift $((OPTIND-1)) [ "$1" = "--" ] && shift + # Determine if we have to add a password to ~/.pgpass passLine="$dbHost:*:*:$dbUser:$dbPass" @@ -71,40 +91,39 @@ else fi -# Determine whether we have to checkout the LinkedGeoData git repo -lgdBasePathExists=0 -if [ -d "$lgdBasePath" ]; then - lgdBasePathExists=1 +# Confirm settings before continuation +dbPassText=`echo "$dbPass" | cut -c1-2` +echoerr "-------------------------------------------------------------------" +echoerr "Your settings are:" +echoerr "Database" +echoerr " Name: $dbName" +echoerr " Host: $dbHost" +echoerr " Username: $dbUser" +echoerr " Password: $dbPassText..." +echoerr " Password already configured: $passLineExists" +echoerr " OSM file to load: $osmFile" +echoerr "" +echoerr "Paths:" +echoerr " Osmosis SQL files: $osmosisSqlPath" +echoerr " PostGIS files: $postgisPath" +echoerr " LGD-SQL files: $lgdSqlPath" +echoerr "" +echoerr "-------------------------------------------------------------------" + +if [ -z "$osmFile" ]; then + echoerr "Error: No osm file specified for loading" + exit 1 fi -# Confirm settings before continuation -echo "-------------------------------------------------------------------" -echo "Your settings are:" -echo "Database" -echo " Name: $dbName" -echo " Host: $dbHost" -echo " Username: $dbUser" -echo " Password: $dbPass" -echo " Password already configured: $passLineExists" -echo " OSM file to load: $osmFile" - -echo "Paths:" -echo " LinkedGeoData Git Repo: $lgdBasePath (exists: $lgdBasePathExists)" -echo " Osmosis SQL files: $osmosisSqlPath" -echo " PostGIS files: $postgisPath" - -echo "-------------------------------------------------------------------" read -p "Press [Enter] key to start loading" + if [ $passLineExists -eq 0 ]; then echo "$passLine" >> ~/.pgpass chmod 600 ~/.pgpass fi -if [ $lgdBasePathExists -eq 0 ]; then - git clone git@github.com:GeoKnow/LinkedGeoData.git "$lgdBasePath" -fi createdb -h "$dbHost" -U "$dbUser" "$dbName" createlang -h "$dbHost" -U "$dbUser" plpgsql "$dbName" @@ -128,7 +147,7 @@ fi #git clone git@github.com:GeoKnow/LinkedGeoData.git -./prepare-interlinks.sh > "interlinks.sql" +"$lgdPrepareInterlinksCmd" > "/tmp/linkedgeodata/interlinks.sql" # LGD Modifications psql -h "$dbHost" -U "$dbUser" -d "$dbName" -f "$lgdSqlPath/LinkedGeoData3 Physical Schema.sql" @@ -136,6 +155,6 @@ psql -h "$dbHost" -U "$dbUser" -d "$dbName" -f "$lgdSqlPath/LinkedGeoData3 Indiv psql -h "$dbHost" -U "$dbUser" -d "$dbName" -f "$lgdSqlPath/ExtraOsmIndexes.sql" psql -h "$dbHost" -U "$dbUser" -d "$dbName" -f "$lgdSqlPath/Mappings.sql" psql -h "$dbHost" -U "$dbUser" -d "$dbName" -f "$lgdSqlPath/TranslateWikiLabels.sql" -psql -h "$dbHost" -U "$dbUser" -d "$dbName" -f "interlinks.sql" +psql -h "$dbHost" -U "$dbUser" -d "$dbName" -f "/tmp/linkedgeodata/interlinks.sql" diff --git a/linkedgeodata-cli/bin/lgd-download-and-install-dependecies.sh b/linkedgeodata-cli/bin/lgd-download-and-install-dependecies.sh new file mode 100755 index 0000000..1a9262e --- /dev/null +++ b/linkedgeodata-cli/bin/lgd-download-and-install-dependecies.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# +# This script fetches and installs the latest sparqlify and linkedgeodata debian packages +# + +if [[ "$USER" != "root" ]]; then + echo "Must be run as root" + exit 1 +fi + + +tmp=`mktemp -d` +echo "Working in directory: $tmp" + +cd "$tmp" + +wget --no-directories --accept="sparqlify*.deb" -r -l 1 "http://cstadler.aksw.org/repos/apt/pool/main/s/sparqlify/" +#wget --no-directories --accept='linkedgeodata*.deb$' -r -l 1 http://cstadler.aksw.org/repos/apt/pool/main/l/linkedgeodata/ + +declare -A patterns +patterns[0]="sparqlify*.deb" +#patterns[1]="linkedgeodata*.deb" + + +for pattern in "${patterns[@]}"; do + file=`ls $pattern` + dpkg -i "$file" +done + diff --git a/bin/prepare-interlinks.sh b/linkedgeodata-cli/bin/lgd-prepare-interlinks.sh similarity index 60% rename from bin/prepare-interlinks.sh rename to linkedgeodata-cli/bin/lgd-prepare-interlinks.sh index 285dfb4..590495f 100755 --- a/bin/prepare-interlinks.sh +++ b/linkedgeodata-cli/bin/lgd-prepare-interlinks.sh @@ -2,13 +2,14 @@ function loadArchive { url="$1" + fileName=${url##*/} baseName=${fileName%%.*} tarFile="$baseName.tar" -# echo "Filename: $fileName" -# echo "$fileName $tarFile $baseName" + #echo "Filename: $fileName" + #echo "$fileName $tarFile $baseName" if [ ! -d "$baseName" ]; then if [ ! -f "$tarFile" ]; then @@ -25,10 +26,13 @@ function loadArchive { find "$baseName" | grep links.nt | xargs cat | sed -r 's|<([^>]*)>\s*<[^>]*>\s*<([^>]*)>.*|\1\t\2|g' | sort -u } +basePath="/tmp/linkedgeodata/" +mkdir -p "$basePath" +cd "$basePath" echo 'COPY lgd_interlinks (s, o) FROM stdin;' -loadArchive 'http://downloads.linkedgeodata.org/releases/110406/LGD-Interlinks-110406-GeoNames.tar.bz2' -loadArchive 'http://downloads.linkedgeodata.org/releases/110406/LGD-Interlinks-110406-DBpedia.tar.bz2' +loadArchive "http://downloads.linkedgeodata.org/releases/2011-04-06/LGD-Interlinks-110406-GeoNames.tar.bz2" +loadArchive "http://downloads.linkedgeodata.org/releases/2011-04-06/LGD-Interlinks-110406-DBpedia.tar.bz2" echo '\.' diff --git a/linkedgeodata-cli/bin/lgd-query.sh b/linkedgeodata-cli/bin/lgd-query.sh new file mode 100755 index 0000000..0329aab --- /dev/null +++ b/linkedgeodata-cli/bin/lgd-query.sh @@ -0,0 +1,134 @@ +#!/bin/bash + +# +# Dump script for LinkedGeoData: +# ./install-lgd.sh data.osm.gz +# +# + +usage="$(basename "$0") options -- program to dump a LinkedGeoData database + +where: + -P profile name ('default' if not specified) + -h postgres host name + -d postgres database name + -u postgres user name + -p postgres password + -Q SPARQL query string + +If the query string is the last argument, -Q can be omitted. +" + + +# +# Hard coded profile paths, with folder precedence order: local > home > etc +# +configFiles[0]="/etc/linkedgeodata/lgd.conf.dist" +configFiles[1]="/etc/linkedgeodata/lgd.conf" +configFiles[2]="./lgd.conf.dist" +configFiles[3]="./lgd.conf" + +for configFile in "${configFiles[@]}"; do + [ -f "$configFile" ] && source "$configFile" + +# echo "Checking $configFile --- $sparqlifyCmd" +done + + +profileName="lgd-default" + + +# By default, the last argument becomes the query string +# Source: http://stackoverflow.com/questions/1853946/getting-the-last-argument-passed-to-a-shell-script +for queryString; do true; done + + +# Simple function to echo to stderr +echoerr() { echo "$@" 1>&2; } + +# Support for simple command line args +# Source: http://mywiki.wooledge.org/BashFAQ/035#getopts +# A POSIX variable +OPTIND=1 # Reset in case getopts has been used previously in the shell. + +while getopts "?h:U:W:d:Q:" opt; do + case "$opt" in + \?) + echoerr "$usage" + exit 0 + ;; + h) dbHost="$OPTARG" + ;; + U) dbUser="$OPTARG" + ;; + W) dbPass="$OPTARG" + ;; + d) dbName="$OPTARG" + ;; + Q) queryString="$OPTARG" + ;; + P) profileName="$OPTARG" + ;; + esac +done + +shift $((OPTIND-1)) + +[ "$1" = "--" ] && shift + + +for profilePath in "${lgdProfilePaths[@]}"; do + profileFile="$profilePath/$profileName.conf" + profileFileDist="$profileFile.dist" + +# echo "Checking $profileFile" + [ -f "$profileFileDist" ] && source "$profileFileDist" + [ -f "$profileFile" ] && source "$profileFile" +done + + + +# TODO This does not work as expected - need to find a more clever way, possible solution: http://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script +#if [ ! -f "$sparqlifyFile" ]; then +# echoerr "Sparqlify executable not found" +# exit 1 +#fi + + +# Check if the query argument actually matches the name of a query template + +if [ -n "$queryString" ]; then + [ ${lgdNamedQueries[$queryString]+isset} ] && queryString="${lgdNamedQueries[$queryString]}" +fi + + +lgdViewFile="$lgdSmlPath/$lgdSmlFile" + +# Confirm settings before continuation +dbPassText=`echo "$dbPass" | cut -c1-2` + +echoerr "-------------------------------------------------------------------" +echoerr "Your settings are:" +echoerr "Database" +echoerr " Name: $dbName" +echoerr " Host: $dbHost" +echoerr " Username: $dbUser" +echoerr " Password: $dbPassText..." +echoerr "" +echoerr "Paths:" +echoerr " Sparqlify command: $sparqlifyCmd" +echoerr " View definition: $lgdViewFile" +echoerr "" +echoerr "Query:" +echoerr " $queryString" +echoerr "-------------------------------------------------------------------" +#read -p "Press [Enter] key to start loading" + +if [ -z "$queryString" ]; then + echoerr "Error: No query string specified" + exit 1 +fi + +"$sparqlifyCmd" -h "$dbHost" -u "$dbUser" -p "$dbPass" -d "$dbName" -m "$lgdViewFile" -Q "$queryString" + + diff --git a/linkedgeodata-cli/bin/lgd.conf.dist b/linkedgeodata-cli/bin/lgd.conf.dist new file mode 100644 index 0000000..c657a1c --- /dev/null +++ b/linkedgeodata-cli/bin/lgd.conf.dist @@ -0,0 +1,8 @@ +#!/bin/bash +source ../../linkedgeodata-debian/src/deb/resources/etc/linkedgeodata/lgd.conf.dist + +lgdPrepareInterlinksCmd="./lgd-prepare-interlinks.sh" + +lgdSqlPath="../../linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql" +lgdSmlPath="../../linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sml" + diff --git a/linkedgeodata-core/src/main/sparqlify/LinkedGeoData-Triplify-IndividualViews-Wiki.sparqlify b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sml/LinkedGeoData-Triplify-IndividualViews-Wiki.sml similarity index 100% rename from linkedgeodata-core/src/main/sparqlify/LinkedGeoData-Triplify-IndividualViews-Wiki.sparqlify rename to linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sml/LinkedGeoData-Triplify-IndividualViews-Wiki.sml diff --git a/linkedgeodata-core/src/main/sparqlify/LinkedGeoData-Triplify-IndividualViews.sparqlify b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sml/LinkedGeoData-Triplify-IndividualViews.sml similarity index 87% rename from linkedgeodata-core/src/main/sparqlify/LinkedGeoData-Triplify-IndividualViews.sparqlify rename to linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sml/LinkedGeoData-Triplify-IndividualViews.sml index 89ead8c..b14ebc8 100644 --- a/linkedgeodata-core/src/main/sparqlify/LinkedGeoData-Triplify-IndividualViews.sparqlify +++ b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sml/LinkedGeoData-Triplify-IndividualViews.sml @@ -134,6 +134,97 @@ Create View view_resource_labels As +// Properties +Create View view_properties_k As + Construct { + ?s + a owl:Property ; + a owl:ObjectProperty ; + rdfs:domain spatial:Feature ; + rdfs:range owl:Thing . + } + With + ?s = uri(?property) + Constrain + ?s prefix "http://linkedgeodata.org/ontology/" + From + lgd_map_resource_prefix + + +/* TODO Not sure how to adress the following tables best... +Create View view_object_properties As + Construct { + ?s + a owl:Property ; + a owl:ObjectProperty ; + rdfs:domain spatial:Feature ; + rdfs:range lgdo:Sport . + } + With + + From + [[SELECT property FROM lgd_map_resource_kv WHERE + + +Create View static_properties As + Construct { + + http://www.w3.org/1999/02/22-rdf-syntax-ns#type + http://linkedgeodata.org/ontology/featuresSport + http://linkedgeodata.org/ontology/wheelchair + http://linkedgeodata.org/ontology/agricultural + http://linkedgeodata.org/ontology/featuresAbutters + + } +*/ + +Create View property_int As + Construct { + ?s + a owl:Property ; + a owl:DatatypeProperty ; + rdfs:range xsd:integer . + } + With + ?s = uri(?property) + Constrain + ?s prefix "http://linkedgeodata.org/ontology/" + From + [[SELECT b.property FROM lgd_map_datatype a JOIN lgd_map_property b ON (a.k = b.k) WHERE a.datatype = 'int']] + + +Create View property_double As + Construct { + ?s + a owl:Property ; + a owl:DatatypeProperty ; + rdfs:range xsd:double . + } + With + ?s = uri(?property) + Constrain + ?s prefix "http://linkedgeodata.org/ontology/" + From + [[SELECT b.property FROM lgd_map_datatype a JOIN lgd_map_property b ON (a.k = b.k) WHERE a.datatype = 'float']] + + +Create View property_boolean As + Construct { + ?s + a owl:Property ; + a owl:DatatypeProperty ; + rdfs:range xsd:boolean . + } + With + ?s = uri(?property) + Constrain + ?s prefix "http://linkedgeodata.org/ontology/" + From + [[SELECT b.property FROM lgd_map_datatype a JOIN lgd_map_property b ON (a.k = b.k) WHERE a.datatype = 'boolean']] + + + + /************* * Nodes *************/ diff --git a/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sml/lgd-default-wiki.sml b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sml/lgd-default-wiki.sml new file mode 120000 index 0000000..8427ec9 --- /dev/null +++ b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sml/lgd-default-wiki.sml @@ -0,0 +1 @@ +LinkedGeoData-Triplify-IndividualViews-Wiki.sml \ No newline at end of file diff --git a/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sml/lgd-default.sml b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sml/lgd-default.sml new file mode 120000 index 0000000..e6df04c --- /dev/null +++ b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sml/lgd-default.sml @@ -0,0 +1 @@ +LinkedGeoData-Triplify-IndividualViews.sml \ No newline at end of file diff --git a/linkedgeodata-core/src/main/sql/DeletionQueries.sql b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/DeletionQueries.sql similarity index 100% rename from linkedgeodata-core/src/main/sql/DeletionQueries.sql rename to linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/DeletionQueries.sql diff --git a/linkedgeodata-core/src/main/sql/ExtraOsmIndexes.sql b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/ExtraOsmIndexes.sql similarity index 100% rename from linkedgeodata-core/src/main/sql/ExtraOsmIndexes.sql rename to linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/ExtraOsmIndexes.sql diff --git a/linkedgeodata-core/src/main/sql/LinkedGeoData3 Individual Views.sql b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/LinkedGeoData3 Individual Views.sql similarity index 100% rename from linkedgeodata-core/src/main/sql/LinkedGeoData3 Individual Views.sql rename to linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/LinkedGeoData3 Individual Views.sql diff --git a/linkedgeodata-core/src/main/sql/LinkedGeoData3 Physical Schema.sql b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/LinkedGeoData3 Physical Schema.sql similarity index 100% rename from linkedgeodata-core/src/main/sql/LinkedGeoData3 Physical Schema.sql rename to linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/LinkedGeoData3 Physical Schema.sql diff --git a/linkedgeodata-core/src/main/sql/LinkedGeoData3.sql b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/LinkedGeoData3.sql similarity index 100% rename from linkedgeodata-core/src/main/sql/LinkedGeoData3.sql rename to linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/LinkedGeoData3.sql diff --git a/linkedgeodata-core/src/main/sql/Mappings.sql b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/Mappings.sql similarity index 100% rename from linkedgeodata-core/src/main/sql/Mappings.sql rename to linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/Mappings.sql diff --git a/linkedgeodata-core/src/main/sql/SnapshotViews.sql b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/SnapshotViews.sql similarity index 100% rename from linkedgeodata-core/src/main/sql/SnapshotViews.sql rename to linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/SnapshotViews.sql diff --git a/linkedgeodata-core/src/main/sql/TagStats.sql b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/TagStats.sql similarity index 100% rename from linkedgeodata-core/src/main/sql/TagStats.sql rename to linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/TagStats.sql diff --git a/linkedgeodata-core/src/main/sql/TranslateWikiLabels.sql b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/TranslateWikiLabels.sql similarity index 100% rename from linkedgeodata-core/src/main/sql/TranslateWikiLabels.sql rename to linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/TranslateWikiLabels.sql diff --git a/linkedgeodata-core/src/main/sql/Triggers.sql b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/Triggers.sql similarity index 100% rename from linkedgeodata-core/src/main/sql/Triggers.sql rename to linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/Triggers.sql diff --git a/linkedgeodata-core/src/main/sql/UpdateDatatypesStats.sql b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/UpdateDatatypesStats.sql similarity index 100% rename from linkedgeodata-core/src/main/sql/UpdateDatatypesStats.sql rename to linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/UpdateDatatypesStats.sql diff --git a/linkedgeodata-core/src/main/sql/Wikipedia-Active-But-Prefix-Match-Suboptimal-Yet.sql b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/Wikipedia-Active-But-Prefix-Match-Suboptimal-Yet.sql similarity index 100% rename from linkedgeodata-core/src/main/sql/Wikipedia-Active-But-Prefix-Match-Suboptimal-Yet.sql rename to linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/Wikipedia-Active-But-Prefix-Match-Suboptimal-Yet.sql diff --git a/linkedgeodata-core/src/main/sql/Wikipedia-Trash-ExplicitCondition.sql b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/Wikipedia-Trash-ExplicitCondition.sql similarity index 100% rename from linkedgeodata-core/src/main/sql/Wikipedia-Trash-ExplicitCondition.sql rename to linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/Wikipedia-Trash-ExplicitCondition.sql diff --git a/linkedgeodata-core/src/main/sql/Wikipedia-Trash.sql b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/Wikipedia-Trash.sql similarity index 100% rename from linkedgeodata-core/src/main/sql/Wikipedia-Trash.sql rename to linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/Wikipedia-Trash.sql diff --git a/linkedgeodata-core/src/main/sql/Wikipedia-Trash2.sql b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/Wikipedia-Trash2.sql similarity index 100% rename from linkedgeodata-core/src/main/sql/Wikipedia-Trash2.sql rename to linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/Wikipedia-Trash2.sql diff --git a/linkedgeodata-core/src/main/sql/adaption-of-osm2postgresql_05rc4.sql b/linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/adaption-of-osm2postgresql_05rc4.sql similarity index 100% rename from linkedgeodata-core/src/main/sql/adaption-of-osm2postgresql_05rc4.sql rename to linkedgeodata-core/src/main/resources/org/aksw/linkedgeodata/sql/adaption-of-osm2postgresql_05rc4.sql diff --git a/linkedgeodata-debian/pom.xml b/linkedgeodata-debian/pom.xml new file mode 100644 index 0000000..5ca8776 --- /dev/null +++ b/linkedgeodata-debian/pom.xml @@ -0,0 +1,163 @@ + + + 4.0.0 + + linkedgeodata-debian + jar + + + LinkedGeoData - Debian Packaging + http://aksw.org/Projects/LinkedGeoData + + + + org.aksw.linkedgeodata + linkedgeodata-parent + 0.4-SNAPSHOT + + + + + + + + maven-resources-plugin + 2.4 + + + copy-deb-resources + process-resources + + copy-resources + + + true + ${project.build.directory}/deb + + + src/deb/resources + + + + + + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.6 + + + copy-deb-resources + package + + + + + + + + + + + + + + + + + + + + + + + run + + + + + + fix-permissions + package + + + + + + + + + + + + + + run + + + + + + + + + + + + + + + + + + + + + + + + + + + + net.sf.debian-maven + debian-maven-plugin + 1.0.5 + + linkedgeodata + extra + web + + postgis + sparqlify + + ${project.parent.developers[0].name} + ${project.parent.developers[0].email} + + + + + + + + + + + + diff --git a/linkedgeodata-debian/src/deb/resources/DEBIAN/changelog b/linkedgeodata-debian/src/deb/resources/DEBIAN/changelog new file mode 100644 index 0000000..09dbd6d --- /dev/null +++ b/linkedgeodata-debian/src/deb/resources/DEBIAN/changelog @@ -0,0 +1,6 @@ +sparqlify (0.2) lod2; urgency=low + + * Initial version. + + -- Claus Stadler Mon, 09 Jul 2012 12:25:10 +0200 + diff --git a/linkedgeodata-debian/src/deb/resources/DEBIAN/copyright b/linkedgeodata-debian/src/deb/resources/DEBIAN/copyright new file mode 100644 index 0000000..4c87057 --- /dev/null +++ b/linkedgeodata-debian/src/deb/resources/DEBIAN/copyright @@ -0,0 +1,45 @@ +This work was packaged for Debian by: + + Claus Stadler on Tue, 01 Feb 2011 15:37:27 +0100 + +It was downloaded from: + + + +Upstream Author(s): + + Claus Stadler + +Copyright: + + + +License: + + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License version 2 as + published by the Free Software Foundation. + + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see + +On Debian systems, the complete text of the GNU General +Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + + +TODO Add copyright notice for Jena, Jetty + +The Debian packaging is: + + Copyright (C) 2012 Claus Stadler + +you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + diff --git a/linkedgeodata-debian/src/deb/resources/DEBIAN/links b/linkedgeodata-debian/src/deb/resources/DEBIAN/links new file mode 100644 index 0000000..bbbd130 --- /dev/null +++ b/linkedgeodata-debian/src/deb/resources/DEBIAN/links @@ -0,0 +1,2 @@ +/usr/share/lib/linkedgeodata/lgd-createdb.sh /usr/bin/lgd-createdb +/usr/share/lib/linkedgeodata/lgd-query.sh /usr/bin/lgd-query \ No newline at end of file diff --git a/linkedgeodata-debian/src/deb/resources/DEBIAN/rules b/linkedgeodata-debian/src/deb/resources/DEBIAN/rules new file mode 100755 index 0000000..761c3f0 --- /dev/null +++ b/linkedgeodata-debian/src/deb/resources/DEBIAN/rules @@ -0,0 +1,14 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + +%: + dh $@ + diff --git a/linkedgeodata-debian/src/deb/resources/etc/linkedgeodata/lgd.conf.dist b/linkedgeodata-debian/src/deb/resources/etc/linkedgeodata/lgd.conf.dist new file mode 100644 index 0000000..48ae755 --- /dev/null +++ b/linkedgeodata-debian/src/deb/resources/etc/linkedgeodata/lgd.conf.dist @@ -0,0 +1,59 @@ +#!/bin/bash +# This file is intended to be source'd from other scripts of the LinkedGeoData suite. + +# Note: We recommend to leave this file unchanged, and override these settings in a file +# without the .dist extension + +dbHost="localhost" +dbName="lgd" +dbUser="postgres" +dbPass="postgres" + +sparqlifyCmd="sparqlify" +lgdPrepareInterlinksCmd="lgd-prepare-interlinks" + +for profilePath in "${profilePaths[@]}"; do + profileFile="$profilePath/$profileName.conf" + [ -f "$profileFile" ] && source "$profileFile" +done + +lgdSmlPath="/usr/share/linkedgeodata/sml" +lgdSmlFile="LinkedGeoData-Triplify-IndividualViews.sml" + +lgdSqlPath="/usr/share/linkedgeodata/sql" + + +postgisPath="/usr/share/postgresql/9.1/contrib/postgis-2.0" +osmosisSqlPath="/usr/share/doc/osmosis/examples" + + + +# If you want to load a pbf file, set the following variable, e.g: +#osmFile=/your/path/bremen-06-03-2013.osm.pbf + +# You can find chunked OSM files here: http://download.geofabrik.de/openstreetmap/ +# Planet files are available at: http://planet.openstreetmap.org + + +## +# Profiles provide a convenient way switching between multiple lgd database instances on the system +# +# +declare -A lgdProfilePaths +lgdProfilePaths[0]="~/.config/linkedgeodata/profile.d" +lgdProfilePaths[1]="~/etc/linkedgeodata/profile.d" +lgdProfilePaths[2]="." + + +## +# Named queries provide a convenient way to execute queries on a lgd dataset +# lgd-query +# +declare -A lgdNamedQueries + +lgdNamedQueries["ontology"]='Prefix owl: Construct { ?s ?p ?o } { ?s a ?t ; ?p ?o . Filter(?t = owl:Class || ?t = owl:Property) }' + +lgdNamedQueries["dump"]='Construct { ?s ?p ?o } { ?s ?p ?o }' + + + diff --git a/linkedgeodata-debian/src/deb/resources/usr/bin/lgd-createdb b/linkedgeodata-debian/src/deb/resources/usr/bin/lgd-createdb new file mode 100644 index 0000000..7113844 --- /dev/null +++ b/linkedgeodata-debian/src/deb/resources/usr/bin/lgd-createdb @@ -0,0 +1,4 @@ +#!/bin/bash + +/bin/bash /usr/share/linkedgeodata/lgd-createdb.sh "$@" + diff --git a/linkedgeodata-debian/src/deb/resources/usr/bin/lgd-prepare-interlinks b/linkedgeodata-debian/src/deb/resources/usr/bin/lgd-prepare-interlinks new file mode 100644 index 0000000..d94a6ad --- /dev/null +++ b/linkedgeodata-debian/src/deb/resources/usr/bin/lgd-prepare-interlinks @@ -0,0 +1,4 @@ +#!/bin/bash + +/bin/bash /usr/share/linkedgeodata/lgd-prepare-interlinks.sh "$@" + diff --git a/linkedgeodata-debian/src/deb/resources/usr/bin/lgd-query b/linkedgeodata-debian/src/deb/resources/usr/bin/lgd-query new file mode 100644 index 0000000..b20a133 --- /dev/null +++ b/linkedgeodata-debian/src/deb/resources/usr/bin/lgd-query @@ -0,0 +1,4 @@ +#!/bin/bash + +/bin/bash /usr/share/linkedgeodata/lgd-query.sh "$@" + diff --git a/pom.xml b/pom.xml index 0b92054..ea85bed 100644 --- a/pom.xml +++ b/pom.xml @@ -1,15 +1,30 @@ 4.0.0 + org.aksw.linkedgeodata linkedgeodata-parent 0.4-SNAPSHOT - linkedgeodata parent - LinkedGeoData.org - Adding a spatial dimension to the Web of Data. + + LinkedGeoData - Parent + linkedgeodata.org - Adding a spatial dimension to the Web of Data. pom + + + Claus Stadler + cstadler@informatik.uni-leipzig.de + + lead developer + + http://aksw.org + + + - linkedgeodata-core + + + linkedgeodata-debian