Git Product home page Git Product logo

iotics-sparql-http's Introduction

IOTICSpace SPARQL over HTTP

A connector proxying sparql over HTTP to the gRPC federated graph of an IOTICS network.

Build and Test

Build with

mvn clean package

Run

java -jar iotics-sparql-http-<version>.jar

The following variables are either read from the environment or via program arguments. Environment values will always be preferred if not null.

Property default optional description
HOST_DNS n/a yes the DNS of the host where to forward gRPC requests to. If omitted, the host will be taken via the X-IOTICS-HOST
PORT 8080 yes port where the porxy http listener is deployed
TOKEN n/a yes a valid token passed on by the proxy in lieu of the one extracted via the Authorization header. The latter will always override this value.

Example:

java -jar iotics-sparql-http-<version>.jar HOST_DNS=myhost.iotics.space PORT=80

Integration Tests

To run the integration tests(manually, from within the IDE), you need to create an .env file with the following content

PORT=<the port where the HTTP endpoint is listening>
HOST_DNS=<the host DNS where to forward the gRPC requests>
RESOLVER_URL=<the resolver used to manage identities (find it at https://{HOST_DNS}/index.json)>
SEED=<a valid identity seed>

Use

The proxy should implement most of https://www.w3.org/TR/sparql11-protocol/ for SELECT.

Endpoints

The following endpoints are supported for GET and POST

Endpoint description
/sparql/local for requests scoped to the local IOTICSpace only
/sparql for requests scoped to the network

Required headers

Authorization: Bearer <token>
Accept: application/sparql-results+json

Required headers for a SPARQL via POST

for an unencoded body

Content-Type: application/sparql-query

for a form encoded query in the body

Content-Type: application/x-www-form-urlencoded

Required headers for dynamic proxying

X-IOTICS-HOST: <host DNS>

SPARQL request example

Assuming the proxy is deployed on localhost:8080

GET /sparql/local?query=<urlencoded query> HTTP/1.1
Host: localhost
Accept: application/sparql-results+json
Authorization: Bearer eyJhbG...sjc4Q_Q
POST /sparql/local HTTP/1.1
Host: localhost
Accept: application/sparql-results+json
Authorization: Bearer eyJhbG...sjc4Q_Q
Content-Type: application/sparql-query

<query>

Limitations

  • No support for default-graph-uriand named-graph-uri
  • No support for CORS and OPTION (pre-flight requests)

iotics-sparql-http's People

Contributors

smartrics avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.