How to use sparql-http-client - 3 common examples

To help you get started, we’ve selected a few sparql-http-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zazukoians / trifid-ld / lib / trifid-handler-sparql.js View on Github external
/* global log */

'use strict'

var httpError = require('http-errors')
var SparqlHttpClient = require('sparql-http-client')

SparqlHttpClient.fetch = require('node-fetch')

function SparqlHandler (options) {
  this.existsQuery = options.existsQuery
  this.graphQuery = options.graphQuery
  this.client = new SparqlHttpClient({endpointUrl: options.endpointUrl})
}

SparqlHandler.prototype.buildExistsQuery = function (iri) {
  return this.existsQuery.split('${iri}').join(iri) // eslint-disable-line no-template-curly-in-string
}

SparqlHandler.prototype.buildGraphQuery = function (iri) {
  return this.graphQuery.split('${iri}').join(iri) // eslint-disable-line no-template-curly-in-string
}

SparqlHandler.prototype.exists = function (iri) {
github zazuko / openlayers-elements / elements / ol-swiss-cantons.ts View on Github external
import {customElement, html, LitElement, property, query} from 'lit-element'
import {until} from 'lit-html/directives/until'
import Sparql from 'sparql-http-client'

import OlMap from './ol-map'
import './ol-map'
import OlWktLayer from './ol-wkt-layer'
import './ol-wkt-layer'
import './ol-layer-openstreetmap'
import './ol-control'
import './ol-select'

Sparql.fetch = (a,b) => {
    return window.fetch(a, b)
}
const endpoint = new Sparql({endpointUrl: 'https://ld.geo.admin.ch/query'})

const sparql = `
PREFIX xsd: 
PREFIX schema: 
PREFIX dct: 
PREFIX rdf: 
PREFIX geo: 

SELECT ?canton ?cantonShape ?cantonShapeLabel WHERE {
    ?canton a  ;
          ;
  	    dct:hasVersion ?version .
github zazuko / openlayers-elements / elements / ol-swiss-cantons.ts View on Github external
import {customElement, html, LitElement, property, query} from 'lit-element'
import {until} from 'lit-html/directives/until'
import Sparql from 'sparql-http-client'

import OlMap from './ol-map'
import './ol-map'
import OlWktLayer from './ol-wkt-layer'
import './ol-wkt-layer'
import './ol-layer-openstreetmap'
import './ol-control'
import './ol-select'

Sparql.fetch = (a,b) => {
    return window.fetch(a, b)
}
const endpoint = new Sparql({endpointUrl: 'https://ld.geo.admin.ch/query'})

const sparql = `
PREFIX xsd: 
PREFIX schema: 
PREFIX dct: 
PREFIX rdf: 
PREFIX geo: 

SELECT ?canton ?cantonShape ?cantonShapeLabel WHERE {
    ?canton a  ;
          ;
  	    dct:hasVersion ?version .
 
    ?version schema:validUntil "2018-12-31"^^xsd:date ;
        geo:hasGeometry/geo:asWKT ?cantonShape ;
        schema:name ?cantonShapeLabel .                                        

sparql-http-client

Simplified SPARQL HTTP request client

MIT
Latest version published 3 months ago

Package Health Score

68 / 100
Full package analysis

Popular sparql-http-client functions