@ezs/sparql
SPARQL module for ezs
Last updated 4 months ago by touv .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @ezs/sparql 
SYNC missed versions from official npm registry.

sparql

Ce plugin propose une série d'instructions liée à l’usage d’un SPARQL Endpoint.

installation

npm install @ezs/sparql

usage

Table of Contents

SPARQLDecodeQuery

  • **See: SPARQLQuery **

Take a query share link from a YASGUI editor and convert it into an object which contains the query and the endpoint. Then, it could be used by SPARQLQuery instruction.

Examples

Input:

{
  linkQuery: 'https://data.istex.fr/triplestore/sparql/#query=SELECT+DISTINCT+%3Fg%2C+count(*)+AS+%3Fnb+%0AWHERE+%0A%7B+%0A%09graph+%3Fg+%7B+%3Fs+%3Fp+%3Fo+%7D+%0A%7D+%0ALIMIT+3&contentTypeConstruct=text%2Fturtle&endpoint=https%3A%2F%2Fdata.istex.fr%2Fsparql%2F&outputFormat=table'
}

Output:

{ query: 'SELECT DISTINCT ?g, count(*) AS ?nb WHERE { graph ?g { ?s ?p ?o } } LIMIT 3',
 endpoint: 'https://data.istex.fr/sparql/' }

SPARQLQuery

Take a SPARQL query and endpoint and send in output the execution result in JSON format.

Examples

Input:

{ query: 'SELECT DISTINCT ?g, count(*) AS ?nb WHERE { graph ?g { ?s ?p ?o } } LIMIT 3',
 endpoint: 'https://data.istex.fr/sparql/' }

Ouput:

{ "head": { "link": [], "vars": ["g", "nb"] },
  "results": { "distinct": false, "ordered": true, "bindings": [
    { "g": {
         "type": "uri",
         "value": "http://www.openlinksw.com/schemas/virtrdf#"
       },
      "nb": {
         "type": "typed-literal",
         "datatype": "http://www.w3.org/2001/XMLSchema#integer",
         "value": "2477"
    }},
    { "g": {
         "type": "uri",
         "value": "https://bibliography.data.istex.fr/notice/graph"
       },
      "nb": {
         "type": "typed-literal",
         "datatype": "http://www.w3.org/2001/XMLSchema#integer",
         "value": "308023584"
    }},
    { "g": {
         "type": "uri",
         "value": "https://scopus-category.data.istex.fr/graph"
       },
      "nb": {
         "type": "typed-literal",
         "datatype": "http://www.w3.org/2001/XMLSchema#integer",
         "value": "2542"
    }}
  ]}
}

SPARQLToDistinct

  • **See: SPARQLQuery **

Format SPARQLQuery result as a LODEX routine.

The input should contain at least two fields:

  • the first is corresponding with the _id output field
  • the second is corresponding with the value output field

Warning: input's second field value should contain an integer

Examples

Input:

{ "head": { "link": [], "vars": ["g", "nb"] },
  "results": { "distinct": false, "ordered": true, "bindings": [
    { "g": {
         "type": "uri",
         "value": "http://www.openlinksw.com/schemas/virtrdf#"
       },
      "nb": {
         "type": "typed-literal",
         "datatype": "http://www.w3.org/2001/XMLSchema#integer",
         "value": "2477"
    }},
    { "g": {
         "type": "uri",
         "value": "https://bibliography.data.istex.fr/notice/graph" },
      "nb": {
         "type": "typed-literal",
         "datatype": "http://www.w3.org/2001/XMLSchema#integer",
         "value": "308023584" }},
    { "g": {
         "type": "uri",
         "value": "https://scopus-category.data.istex.fr/graph"},
      "nb": {
         "type":
         "typed-literal",
         "datatype": "http://www.w3.org/2001/XMLSchema#integer",
         "value": "2542"
    }}
  ]}
}

Output:

{
   "total": 3,
   "data": [{
        "_id": "http://www.openlinksw.com/schemas/virtrdf#",
        "value": 2477
      }, {
        "_id": "https://bibliography.data.istex.fr/notice/graph",
        "value": 308023584
      }, {
         "_id": "https://scopus-category.data.istex.fr/graph",
         "value": 2542
       }
   ]
}

Current Tags

  • 1.0.12                                ...           latest (4 months ago)

12 Versions

  • 1.0.12                                ...           4 months ago
  • 1.0.11                                ...           7 months ago
  • 1.0.10                                ...           7 months ago
  • 1.0.9                                ...           8 months ago
  • 1.0.8                                ...           8 months ago
  • 1.0.6                                ...           9 months ago
  • 1.0.5                                ...           10 months ago
  • 1.0.4                                ...           a year ago
  • 1.0.3                                ...           a year ago
  • 1.0.2                                ...           a year ago
  • 1.0.1                                ...           a year ago
  • 1.0.0                                ...           a year ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (2)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |