{"_id":"sparql","_rev":"5-f5104cde7c160f2fe4a2bef748f5b77d","name":"sparql","description":"Simple, low-level SPARQL client","dist-tags":{"latest":"0.1.3"},"versions":{"0.0.1":{"name":"sparql","description":"Simple, low-level SPARQL (HTTP) client","version":"0.0.1","author":{"name":"Aldo Bucchi","email":"aldo.bucchi@gmail.com"},"dependencies":{"request":">= 1.9.0","coffee-script":">= 1.0.0"},"keywords":["sparql","rdf","linkeddata"],"directories":{"lib":"./lib"},"engines":{"node":">= 0.4.1"},"_id":"sparql@0.0.1","_engineSupported":true,"_npmVersion":"0.3.12","_nodeVersion":"v0.4.1","files":[""],"_defaultsLoaded":true,"dist":{"shasum":"ce097c5196275390f9f74e440979b174ad542376","tarball":"https://registry.npmjs.org/sparql/-/sparql-0.0.1.tgz","integrity":"sha512-nDcRQCQ61oG1rihaF7NtJ4r9RrRIjbvcKlQ0m9rkcI2wldRsVAHH9K7rGFS1mjpan8xeL+nkIPDJCbYfkJ1rYg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDZkl92u9jjEHLKgciVCnmrWRqt82ilBGjwXc/3qZLcPwIhANdTWqV1yenWHs7LVlNrshKvB0MDeYw0h4+z8bCFDslV"}]}},"0.1.2":{"name":"sparql","description":"Simple, low-level SPARQL client","version":"0.1.2","maintainers":[{"name":"aldobucchi","email":"aldo.bucchi@gmail.com"}],"dependencies":{"request":"1.9.0","coffee-script":"1.2.x"},"keywords":["sparql","rdf","linkeddata"],"directories":{"lib":"./lib"},"engines":{"node":">= 0.2.6"},"_npmUser":{"name":"aldobucchi","email":"aldo.bucchi@gmail.com"},"_id":"sparql@0.1.2","devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.1","_nodeVersion":"v0.6.6","_defaultsLoaded":true,"dist":{"shasum":"f76032956897f1d043457ce38016015f801a2d36","tarball":"https://registry.npmjs.org/sparql/-/sparql-0.1.2.tgz","integrity":"sha512-HMb1pdr5uYvEKnpxfLSlCNGLZ8xytXJpK5Ksn1ONRVsBjxH1CFZSOKfr+XlTyEcNsfIT9fWH+RSpMXqFwCBffQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHNHWNirxO699UoL0spsmHAgNq9DfCqGZxpEMElUyrtYAiBoeFMJZy3wbfXq/C1xKlgJx85aTccvPN8PEPyhKIsliQ=="}]}},"0.1.3":{"name":"sparql","description":"Simple, low-level SPARQL client","version":"0.1.3","maintainers":[{"name":"aldobucchi","email":"aldo.bucchi@gmail.com"}],"dependencies":{"request":"1.9.0","coffee-script":"1.2.x"},"keywords":["sparql","rdf","linkeddata"],"directories":{"lib":"./lib"},"engines":{"node":">= 0.2.6"},"_npmUser":{"name":"aldobucchi","email":"aldo.bucchi@gmail.com"},"_id":"sparql@0.1.3","devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.1","_nodeVersion":"v0.6.6","_defaultsLoaded":true,"dist":{"shasum":"bf9323846666d9c07c60e8872e77bb86b3514b07","tarball":"https://registry.npmjs.org/sparql/-/sparql-0.1.3.tgz","integrity":"sha512-LW7mq5gDHrFrH/+tTom1LsSc7n0sseVeGAmEIWcuLObORrYDCvJDNbqoco1yXXya+NULe6NDRmNFDqO3yzfvQg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFuE1Qp0QeDtj5gf8LaGxC70GLTJj1Tc6vMmOpz7HgjFAiEAu19Erlfu/WmAI0Y733oK7E/GBZ+m4ladXOoI/CXWLEo="}]}}},"maintainers":[{"name":"aldobucchi","email":"aldo.bucchi@gmail.com"}],"time":{"modified":"2022-06-26T22:36:05.349Z","created":"2011-04-11T09:51:49.464Z","0.0.1":"2011-04-11T09:51:50.147Z","0.1.2":"2012-03-18T05:13:25.672Z","0.1.3":"2012-03-19T05:12:24.424Z"},"author":{"name":"Aldo Bucchi","email":"aldo.bucchi@gmail.com"},"readme":"Simple SPARQL HTTP Client library for Node.js\n=============================================\n\nGetting Started\n--------------------\n\n### Install\n\n    npm install sparql\n\n### Use\n\n    sparql = require 'sparql'\n    client = new sparql.Client 'http://dbpedia.org/sparql'\n    client.query 'select * where { ?s ?p ?o } limit 100', (err, res) ->\n      console.log res\n\nThe result of calling the query() function will be a raw object conforming to the SPARQL-JSON[1] results format. \n\nCore API\n--------------------\n\n### query\n\nLow level function. Returns the complete [SPARQL-JSON][sparql-json] results object.\n\n    client.query 'select * where {?s ?p ?o} limit 10', (err, res) ->\n      console.log row.s for row in res.results.bindings\n\nConvenience Query Methods\n------------------------------\n\n### rows\n\nConvenience method to get to the rows directly. Builds on top of sparql.query, like most of the\nother query methods.\n\n    client.rows 'select * where {?s ?p ?o} limit 10', (err, res) ->\n      console.log row.s for row in res\n\n### row\n\nConvenience method that only returns the first row in the result set\n\n    client.row 'select * where {?s ?p ?o} limit 10', (err, res) ->\n      console.log res.s\n\n### col\n\nConvenience method that returns an array of with the first value of each row\n\n    client.col 'select distinct ?name where {?s foaf:name ?name} limit 10', (err, res) ->\n      console.log( rdf_value.value ) for rdf_value in res\n\nWhat's with the rdf_value.value part?\nRead the [SPARQL-JSON][sparql-json] results format specification page.\n\n### cell\n\nConvenience method that returns only the first binding of the first row or NULL\n\n    client.col 'select ?name where {?s foaf:name ?name} limit 1', (err, res) ->\n      console.log res\n\n\nConvenience Update Methods\n------------------------------\n\nThere are a bunch of higher level methods that generate SPARQL for you.\nI am providing a small number of such methods, as I don't want this library to grow into something like Active Record.\n\nWriting SPARQL by hand is highly encouraged.\n\n### set\n\nProvide an abstraction atop a simple 'entity oriented' operation that is not so simple when you are working with SPARQL.\n\nImagine you want to do something like this, conceptually speaking:\n\n    aldo.name = 'Aldo'\n\nYou can get that with one simple call to the API\n\n    client.set '<urn:test:graph>', '<urn:test:aldo>', '<urn:test:name>', '\"Aldo\"', no, (err, res) ->\n      console.log 'Aldo is now named Aldo, hooray!' \n\nNot so simple? Well, compare that to the SPARQL Update statement that gets generated under the covers:\n\n    modify <urn:test:graph> \n      delete { <urn:test:aldo> <urn:test:name> ?x } \n      insert { <urn:test:aldo> <urn:test:name> \"Aldo\" } \n      where { optional{ <urn:test:aldo> <urn:test:name> ?x } }\n\nNotice that, if `<urn:test:aldo>` had a previous `<urn:test:name>`, it will be replaced. If it doesn't, then a new triple will be inserted.\n\nYou can also delete a value by setting it to null ( effectively removing one or more triples )\n\n    client.set '<urn:test:graph>', '<urn:test:aldo>', '<urn:test:name>', null, no, (err, res) ->\n      console.log 'Aldo went back to anonimity'\n\nIn this case, the generated SPARQL is:\n\n    delete from <urn:test:graph>\n      { <urn:test:aldo> <urn:test:name> ?x }\n      where { <urn:test:aldo> <urn:test:name> ?x }\n\nThe 5th parameter is a boolean flag indicating whether the triple patterns should be inverted ( useful for when you only have the reversed predicate )\n\n### mset\n\nOne Subject, several pairs Predicate-Object \n\nLet's group some attributes of an user\n\n\tattributes = \n\t\t'<urn:test:username>' : 'haj'\n\t\t'<urn:test:password>' : '123'\n\t\t'<urn:test:name>' : 'Herman'\n\nAnd we invoke mset\n\t\n\tclient.mset  '<urn:test:graph>', <urn:test:haj>', attributes, (err, res) ->\n\t\tif err?\n\t\t\tconsole.log 'Success'\n\t\telse\n\t\t\tconsole.log 'Error: ' + err\n\nThe SPARQL query generated is:\n\n\tINSERT INTO <urn:test:graph>\n\t\t{ <urn:test:haj> \t<urn:test:username> \t'Haj';\n\t\t\t\t\t\t\t<urn:test:password>\t\t'123';\n\t\t\t\t\t\t\t<urn:test:name>\t\t\t'Herman'. }\n\nTests\n--------------------\n\n### Test Dependencies\n\nYou must have [OpenLink Virtuoso](http://virtuoso.openlinksw.com/dataspace/dav/wiki/Main/) >= 6.1.2 installed and `virtuoso`, `isql` in your path.\n\nAlso, maybe you have to set Virtuoso to allow INSERT and DELETE to be done via sparql:\n\n\t$ isql\n\tSQL> grant execute on DB.DBA.SPARQL_MODIFY_BY_DICT_CONTENTS to \"SPARQL\";\n\n\nYou must also have expresso\n    npm install expresso\n\n### Running the Tests\n\n(Coming Soon)\n\n\n[sparql-json]: http://www.w3.org/TR/rdf-sparql-json-res/\n\n\n","readmeFilename":"","users":{"lazerluke":true}}