Skip to content

Commit

Permalink
Add Sparql provider to pygeoapi image (#5)
Browse files Browse the repository at this point in the history
* Update plugin.py for SPARQL

* Create sparql.py

* Update requirements-provider.txt

* Add files via upload

* Update requirements-provider.txt

* Update api.py

* Update plugin.py

* Update plugin.py

* Update plugin.py

* Squashed commit of the following:

commit 70edc3c
Author: Tom Kralidis <tomkralidis@gmail.com>
Date:   Thu Aug 26 16:30:46 2021 -0400

    update TinyDB q= support for multiple terms (geopython#765)

commit 1ff9dfa
Author: Tom Kralidis <tomkralidis@gmail.com>
Date:   Wed Aug 25 08:24:28 2021 -0400

    update id field passing to HTML template (geopython#764)

commit 6fb64e6
Author: Tom Kralidis <tomkralidis@gmail.com>
Date:   Wed Aug 25 07:22:53 2021 -0400

    fix JSON filter in HTML items/item templates (geopython#761) (geopython#763)

commit 6dcd10b
Author: Tom Kralidis <tomkralidis@gmail.com>
Date:   Wed Aug 25 06:34:39 2021 -0400

    test for item prev and next links on item queries (geopython#752) (geopython#757)

commit 7192012
Author: Alexandre Leroux <alexandreleroux@gmail.com>
Date:   Tue Aug 24 06:37:03 2021 -0400

    updates to French translation (geopython#759)

commit 995ab2f
Author: paul van genuchten <paul.vangenuchten@geocat.net>
Date:   Mon Aug 23 02:42:10 2021 +0200

    add translation system to pygeoapi (geopython#725)

    * adds translation keys to templates

    * adds translation keys to templates

    * suggestions from github pr 2

commit bc97ed4
Author: Tom Kralidis <tomkralidis@gmail.com>
Date:   Sun Aug 22 08:28:56 2021 -0400

    add geometry to queryables (geopython#755)

commit 9d92090
Author: Tom Kralidis <tomkralidis@gmail.com>
Date:   Wed Aug 18 15:28:55 2021 -0400

    update OAProc execute handling (geopython#754)

    * fix OAProc default output to raw

    * control outputs list from api machinery

    * fix tests

* Squashed commit of the following:

commit 774ff49
Author: Tom Kralidis <tomkralidis@gmail.com>
Date:   Wed Sep 1 09:02:28 2021 -0400

    update translations (geopython#760) (geopython#762)

    * update translations (geopython#760)

    * fix syntax

    * update translations

    * update docs

    * fix typos

commit cf9bd22
Author: Tom Kralidis <tomkralidis@gmail.com>
Date:   Tue Aug 31 10:11:31 2021 -0400

    Update plugins.rst (geopython#770)

commit 70edc3c
Author: Tom Kralidis <tomkralidis@gmail.com>
Date:   Thu Aug 26 16:30:46 2021 -0400

    update TinyDB q= support for multiple terms (geopython#765)

commit 1ff9dfa
Author: Tom Kralidis <tomkralidis@gmail.com>
Date:   Wed Aug 25 08:24:28 2021 -0400

    update id field passing to HTML template (geopython#764)

commit 6fb64e6
Author: Tom Kralidis <tomkralidis@gmail.com>
Date:   Wed Aug 25 07:22:53 2021 -0400

    fix JSON filter in HTML items/item templates (geopython#761) (geopython#763)

commit 6dcd10b
Author: Tom Kralidis <tomkralidis@gmail.com>
Date:   Wed Aug 25 06:34:39 2021 -0400

    test for item prev and next links on item queries (geopython#752) (geopython#757)

commit 7192012
Author: Alexandre Leroux <alexandreleroux@gmail.com>
Date:   Tue Aug 24 06:37:03 2021 -0400

    updates to French translation (geopython#759)

commit 995ab2f
Author: paul van genuchten <paul.vangenuchten@geocat.net>
Date:   Mon Aug 23 02:42:10 2021 +0200

    add translation system to pygeoapi (geopython#725)

    * adds translation keys to templates

    * adds translation keys to templates

    * suggestions from github pr 2

commit bc97ed4
Author: Tom Kralidis <tomkralidis@gmail.com>
Date:   Sun Aug 22 08:28:56 2021 -0400

    add geometry to queryables (geopython#755)

commit 9d92090
Author: Tom Kralidis <tomkralidis@gmail.com>
Date:   Wed Aug 18 15:28:55 2021 -0400

    update OAProc execute handling (geopython#754)

    * fix OAProc default output to raw

    * control outputs list from api machinery

    * fix tests

* Prepare for merge into internetofwater/pygeoapi
  • Loading branch information
webb-ben committed Feb 23, 2022
1 parent d34bf63 commit 3a7c133
Show file tree
Hide file tree
Showing 7 changed files with 526 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docker/examples/sparql/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM internetofwater/pygeoapi:latest

ADD ./ext_data.zip /ext_data
COPY ./sparql.pygeoapi.config.yml /pygeoapi/local.config.yml
41 changes: 41 additions & 0 deletions docker/examples/sparql/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# =================================================================
#
# Authors: Benjamin Webb <benjamin.miller.webb@gmail.com>
#
# Copyright (c) 2021 Benjamin Webb
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# =================================================================

version: "3"

services:

pygeoapi:
build:
context: .
ports:
- "5000:80"
volumes:
- ./ext_data:/ext_data
- ./sparql.pygeoapi.config.yml:/pygeoapi/local.config.yml
Binary file added docker/examples/sparql/ext_data.zip
Binary file not shown.
194 changes: 194 additions & 0 deletions docker/examples/sparql/sparql.pygeoapi.config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
# =================================================================
#
# Authors: Tom Kralidis <tomkralidis@gmail.com>
#
# Copyright (c) 2020 Tom Kralidis
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# =================================================================

server:
bind:
host: localhost #change to your hostname if running your own instance
port: 5000
url: http://localhost:5000 #change to host URL if running your own instance
mimetype: application/json; charset=UTF-8
encoding: utf-8
language: en-US
cors: true
pretty_print: true
limit: 10
map:
url: https://tile.openstreetmap.org/{z}/{x}/{y}.png
attribution: '<a href="https://www.openstreetmap.org/copyright">© OpenStreetMap contributors</a>'
ogc_schemas_location: /opt/schemas.opengis.net

logging:
level: DEBUG
logfile: /tmp/pygeoapi.log

metadata:
identification:
title: geoconnex reference features
description: Provides reference features for geoconnex.us.
keywords:
- geospatial
- data
- api
keywords_type: theme
terms_of_service: https://creativecommons.org/licenses/by/4.0/
url: https://github.com/internetofwater/geoconnex.us
license:
name: CC-BY 4.0 license
url: https://creativecommons.org/licenses/by/4.0/
provider:
name: Team geoconnex
url: https://github.com/internetofwater/geoconnex.us
contact:
address: 2111 Campus Dr
city: Durham
stateorprovince: North Carolina
postalcode: 27708
country: USA
email: kyle.onda@duke.edu
url: https://internetofwater.org
role: pointOfContact

resources:
places:
type: collection
title: Places
description: Cities around the world and their DBpedia context
keywords:
- Places
- RDF
geojsonld: false
context:
- name: schema:name
description: schema:description
subjectOf: schema:subjectOf
links:
- type: application/html
rel: canonical
title: data source
href: http://dbpedia.org/
hreflang: en-US
extents:
spatial:
bbox: [-180,-90,180,90]
crs: http://www.opengis.net/def/crs/OGC/1.3/CRS84
temporal:
begin: null
end: null
providers:
- type: feature
name: SPARQL
data: /ext_data/places.csv
id_field: index
geometry:
x_field: lon
y_field: lat
sparql_provider: CSV
sparql_endpoint: https://dbpedia.org/sparql
sparql_subject: uri
sparql_predicates:
population: dbo:populationTotal
country: <http://dbpedia.org/ontology/country>
leader: dbpedia2:leaderName
populated:
type: collection
title: Populated Places
description: Populated places, public domain
keywords:
- populated
links:
- type: text/html
rel: canonical
title: information
href: http://www.naturalearthdata.com/
hreflang: en-US
extents:
spatial:
bbox: [-180,-90,180,90]
crs: http://www.opengis.net/def/crs/OGC/1.3/CRS84
temporal:
begin: 2011-11-11
end: null # or empty (either means open ended)
providers:
- type: feature
name: SPARQL
data: /ext_data/ne_110m_populated_places_simple.geojson
id_field: id
sparql_provider: GeoJSON
sparql_endpoint: https://dbpedia.org/sparql
sparql_subject: uri
sparql_predicates:
leader: dbpedia2:leaderName|dbp:leaderName
population: dbo:populationTotal|dbp:populationCensus
states:
type: collection
title: States
description: U.S. States
keywords:
- States
- Census
geojsonld: false
context:
- NAME: schema:name
description: schema:description
subjectOf: schema:subjectOf
census_profile: subjectOf
senator:
"@id": http://dbpedia.org/property/senators
"@type": "@id"
links:
- type: application/html
rel: canonical
title: geographic data source
href: https://www.census.gov/geographies/mapping-files/time-series/geo/cartographic-boundary.html
hreflang: en-US
- type: application/html
rel: canonical
title: Census data source
href: https://data.census.gov/cedsci
hreflang: en-US
extents:
spatial:
bbox: [-170,15,-51,72]
crs: http://www.opengis.net/def/crs/OGC/1.3/CRS84
temporal:
begin: null
end: null
providers:
- type: feature
name: SPARQL
data: /ext_data/states.gpkg
id_field: GEOID
table: states
# uri_field: uri
sparql_provider: SQLiteGPKG
sparql_endpoint: https://dbpedia.org/sparql
sparql_subject: ' :NAME'
sparql_predicates:
senator: dbp:senators
motto: dbo:motto|dbp:motto
1 change: 1 addition & 0 deletions pygeoapi/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
'xarray': 'pygeoapi.provider.xarray_.XarrayProvider',
'MVT': 'pygeoapi.provider.mvt.MVTProvider',
'TinyDBCatalogue': 'pygeoapi.provider.tinydb_.TinyDBCatalogueProvider',
'SPARQL': 'pygeoapi.provider.sparql.SPARQLProvider',
'SensorThings': 'pygeoapi.provider.sensorthings.SensorThingsProvider',
'xarray-edr': 'pygeoapi.provider.xarray_edr.XarrayEDRProvider'
},
Expand Down

0 comments on commit 3a7c133

Please sign in to comment.