{"id":50737640,"url":"https://github.com/vaimee/sepa-js","last_synced_at":"2026-06-10T15:02:00.347Z","repository":{"id":37766600,"uuid":"125240776","full_name":"vaimee/SEPA-js","owner":"vaimee","description":"A js client library for SPARQL Event Processing Architecture","archived":false,"fork":false,"pushed_at":"2024-02-08T16:08:27.000Z","size":1373,"stargazers_count":2,"open_issues_count":7,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-01-14T09:02:49.035Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://site.unibo.it/wot/en","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vaimee.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-14T16:18:11.000Z","updated_at":"2023-09-07T16:18:14.000Z","dependencies_parsed_at":"2024-02-08T17:01:40.549Z","dependency_job_id":"2a1d165b-b63c-43e8-99d5-f16a89ffc1a7","html_url":"https://github.com/vaimee/SEPA-js","commit_stats":null,"previous_names":["arces-wot/sepa-js"],"tags_count":49,"template":false,"template_full_name":null,"purl":"pkg:github/vaimee/SEPA-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaimee%2FSEPA-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaimee%2FSEPA-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaimee%2FSEPA-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaimee%2FSEPA-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vaimee","download_url":"https://codeload.github.com/vaimee/SEPA-js/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vaimee%2FSEPA-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34157453,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-10T15:01:58.520Z","updated_at":"2026-06-10T15:02:00.339Z","avatar_url":"https://github.com/vaimee.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003cbr\u003e\n  \u003ca href=\"\"\u003e\n    \u003cimg width=\"300px\" src=\"./doc/logoJS.png\"\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\n[![Build Status](https://travis-ci.org/arces-wot/SEPA-js.svg?branch=master)](https://travis-ci.org/arces-wot/SEPA-js)\n[![SEPA 0.9.7](https://img.shields.io/badge/SEPA-0.9.7-blue.svg)](https://github.com/arces-wot/SEPA/releases/download/0.9.7/engine-0.9.7.jar)\n[![npm version](https://badge.fury.io/js/%40arces-wot%2Fsepa-js.svg)](https://badge.fury.io/js/%40arces-wot%2Fsepa-js)\n[![Web Version](https://data.jsdelivr.com/v1/package/npm/@arces-wot/sepa-js/badge)](https://www.jsdelivr.com/package/npm/@arces-wot/sepa-js)\n\n\nA minimal SEPA client for browser and nodejs environments.\n**Note** : this library is in an early development stage, use at your own risk.\n\n## Installation\n\n`npm i @arces-wot/sepa-js`\n\nor in your html document\n\n`\u003cscript src=\"https://cdn.jsdelivr.net/npm/@arces-wot/sepa-js/web/sepa.js\"/\u003e`\n\n## Usage\nSEPA-js comes with basic api to interact with the engine (Core API). But it also provides a rich interface to create Dynamic Linked Data applications with the support of **J**SON **S**emantic **A**pplication **P**rofile (JSAP).\n\n### Core API\n\n##### Nodejs:\n```javascript\nconst sepa = require('@arces-wot/sepa-js').client\n```\n##### Browser:\n```javascript\nconst sepa = Sepajs.client\n```\nThe variable presented above returns a pre-configured sepa client instace. The following constructor can be used to have more control about defaults and protocol paramenter.\n\n```javascript\nconst SEPA =  require('@arces-wot/sepa-js').SEPA\nlet client = new SEPA({/*...config...*/})\n```\nthe following is the list of the parameters that can be set in a SEPA client instance:\n```json\n{\n\t\"host\": \"localhost\",\n\t\"oauth\": {\n\t\t\"register\": \"https://localhost:8443/oauth/register\",\n\t\t\"tokenRequest\": \"https://localhost:8443/oauth/token\"\n\t},\n\t\"sparql11protocol\": {\n\t\t\"protocol\": \"http\",\n\t\t\"port\": 8000,\n\t\t\"query\": {\n\t\t\t\"path\": \"/query\",\n\t\t\t\"method\": \"POST\",\n\t\t\t\"format\": \"JSON\"\n\t\t},\n\t\t\"update\": {\n\t\t\t\"path\": \"/update\",\n\t\t\t\"method\": \"POST\",\n\t\t\t\"format\": \"JSON\"\n\t\t}\n\t},\n\t\"sparql11seprotocol\": {\n\t\t\"protocol\": \"ws\",\n\t\t\"availableProtocols\": {\n\t\t\t\"ws\": {\n\t\t\t\t\"port\": 9000,\n\t\t\t\t\"path\": \"/subscribe\"\n\t\t\t},\n\t\t\t\"wss\": {\n\t\t\t\t\"port\": 9443,\n\t\t\t\t\"path\": \"/secure/subscribe\"\n\t\t\t}\n\t\t}\n\t},\n\t\"options\" : {\n\t\t\"httpsAgent\" : httpsAgent,\n\t\t\"headers\" : {\n\t\t\t\"fancy-header\" : \"content\"\n\t\t}\n\t}\n}\n```\nRefer to [official documentation](http://mml.arces.unibo.it/TR/jsap.html#protocol-parameters) for details of protocol parameters, while options field can be configured with the same properties defined in [axios](https://github.com/axios/axios) configuration schema.\n#### Subscribe\nThe subscribe primitive allows a client to receive notifications about a query result. More information about notification data format can be found [here](http://mml.arces.unibo.it/TR/sparql11-subscribe.html#SubscribeResponse). This function as all the others can accept a configuration object as second argument. The object specifies particular parameters that are\nvalid only for this function call. The returned object is a subscription which can be revoked using the unsubscribe function.\n```javascript\nconst sub = sepa.subscribe(\"select * where{?sub ?obj ?pred}LIMIT 1\",{host:\"www.vaimee.com\"})\n\nsub.on(\"subscribed\",console.log)\n\nsub.on(\"notification\", not =\u003e {\n  console.log(\"Notifcation:\");\n\tconsole.log(JSON.stringify(not, null, 2));\n\tsub.unsubscribe()\n})\n\nsub.on(\"error\",console.error)\n```\n\n#### Publish\nThe update function sends the SPARQL 1.1 update given as the first argument. For further information about response format see [here](https://www.w3.org/TR/sparql11-protocol/). Notice that\nalso this function accepts a configuration object as second argument.\n```javascript\nsepa.update(\"insert {\u003chello\u003e \u003cfrom\u003e 'js'}where{}\", {host:\"www.vaimee.com\"})\n    .then(()=\u003e{console.log(\"Updated\");})\n```\n\n#### Query\nFor polling functionalities the query primitive issues a SPARQL 1.1 query to the endpoint. To know more about response data format refer to the [official documentation](https://www.w3.org/TR/sparql11-results-json/).\nThe last argument of this function is the configuartion object used to specific protocol parameters that are valid only for this function call.\n```javascript\nsepa.query(\"select * where {?s ?p 'js'}\", {host:\"www.vaimee.com\"})\n    .then((data)=\u003e{console.log(\"SPARQL bindings: \" + data);})\n```\n\n### Security\nCore api supports secure connection with the endpoint. After obtaining `clientID` and `clientSecret` pair, a secure client can be instatieted with:\n```javascript\nconst SecSEPA = require('@arces-wot/sepa-js').client.secure\n\nconst secClient = new SecSEPA(clientID,clientSecret)\n```\nIf your SEPA instance supports the `register` primitive you can use the corrisponding function in sepa-js.\n```javascript\nconst register = require('@arces-wot/sepa-js').client.secure.register\n\nregister(\"SEPATest\").then(sClient =\u003e{\n\treturn sclient.query(\"select * where {?s ?p 'js'}\")\n})\n```  \n\nSecure client has the same interface of the unsecure one please refer to [Core API](#Core-API) for details.\n\n#### Certificate\nSEPA-js client ships with the default certificate published on SEPA repository, if you have a custom instance of SEPA engine you should\nconfigure the SEPA certificate in your secure client as following:\n\n```javascript\nconst https = require('https')\n// Your certificate\nconst ca = `\nBag Attributes\n    friendlyName: sepakey\n    localKeyID: 54 69 6D 65 20 31 35 35 33 32 34 39 38 34 33 33 34 36\nsubject=/C=IT/ST=Bologna/L=Bologna/CN=localhost\nissuer=/C=IT/ST=Bologna/L=Bologna/CN=localhost\n-----BEGIN CERTIFICATE-----\nMIIDKTCCAhGgAwIBAgIEbMARRzANBgkqhkiG9w0BAQsFADBFMQswCQYDVQQGEwJJ\nVDEQMA4GA1UECBMHQm9sb2duYTEQMA4GA1UEBxMHQm9sb2duYTESMBAGA1UEAxMJ\nbG9jYWxob3N0MB4XDTE5MDMyMjEwMDg1M1oXDTIwMDMxNjEwMDg1M1owRTELMAkG\nA1UEBhMCSVQxEDAOBgNVBAgTB0JvbG9nbmExEDAOBgNVBAcTB0JvbG9nbmExEjAQ\nBgNVBAMTCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB\nAJZ9ajuqEqXGU5QAWyMG3w4hScec9BXjOwDeqseSDDxOx/KuHCG5JDTiQzmPBT96\nLLUGTn+c2l2c+Ezm4Dk11qjpJ+aiiv+gGvyNJmpw/+UwW7wp13O9sMr21GZxexmZ\n/xV/nsXFXXoUurCwZecTzQ6UcNvrvlUy7NVr2TU+ZpwWR/DyKhxe452VJlEaP9Yk\nZu/g9x9rYMs7iG4qErQnGhGS6ds8fU6VrzPCAW9EFxC1SN7r2xnPREU/igv0SilX\ne+tPk167l1wgGyBl3K4Ep7O8RoSE/EhyuooZ9oVenqD/MRlKLso1O2Kv7DslrBpv\n8UufAWxwwEOhDA3XXfblsDkCAwEAAaMhMB8wHQYDVR0OBBYEFCxDyoFe03ccASA9\nJfyvYFEAStceMA0GCSqGSIb3DQEBCwUAA4IBAQBvWzC0qLNhp8L9GkoaNtNKJGEu\nWQkqaMDBtrD4Jy+I75/k73ivvwVgbgg0kq9+jYC48tWwcBsDzqNau+Zay4rWZlf9\nqbnP3+j4hgLIBPrAAvxWQBzLrVOkZK1hXdrS1fNCFmYdIwlEU7M06C3mv69CD/yJ\nvJF2FczexVR2I2L15JdpVlqZ35KwQ8QRTKTtwvQxZeZG56g+Db0vGMMwJqSpPRZc\nWdUXV+2aTVZWdO3avHXkS/qZ0A+8HX8bVvm8O/5b21bIo9BfCf3za3/CAVSNFfNp\nVfDUVhC465CzJcei94rxKyjWTuVl7CZA+6e2x5Ua/4tASi0sFFAlqGJIpiXr\n-----END CERTIFICATE-----\n`\nconst httpsAgent = new https.Agent({ ca: [ca] })\nconst SecSEPA = require('@arces-wot/sepa-js').secure\n\nconst secClient = new SecSEPA(clientID,clientSecret,{ options : {\n\thttpsAgent : httpsAgent\n}})\n\n// Or using  register function\n\nconst register = require('@arces-wot/sepa-js').client.secure.register\n\nregister(\"SEPATest\",{ options : { httpsAgent : httpsAgent}}).then(sClient =\u003e{\n\treturn sclient.query(\"select * where {?s ?p 'js'}\")\n})\n\n```\n\n### Query bench api\nFrom v0.10.0 SEPAjs provides apis to store query templates and substitutes variables. See the following example:\n```javascript\nconst Bench = require('sepajs').bench\n\nbench = new Bench()\nquery = bench.sparql(\"select * where{?a ?b ?c.}\",{\n\ta:{\n\t   type: \"uri\",\n       value :\"urn:epc:id:gid:0.1.0102030405060708090A0B0C\"\n\t}\n})\n// query : select * where{\u003curn:epc:id:gid:0.1.0102030405060708090A0B0C\u003e ?b ?c}\n```\nfor futher details check query bench unit tests [here](./tests/querybench.js).\n\n**Note**: Inside broswers the bench api can be required with `const bench = new Sepajs.bench();` as for other Sepajs functionalities.\n\n### JSAP api\n**J**ons **S**parql **A**pplication **P**rofile. JASAP api leverage on Query Bench API to provide an application development model.\n\n#### Nodejs:\n```javascript\nconst App = require('sepa-js').Jsap\n```\n#### Browser:\n```javascript\nconst JsapApi = Sepajs.Jsap\n```\n\n```javascript\napp = new JsapApi({\n\thost: \"mml.arces.unibo.it\",\n\tqueries : {\n\t\tsimpleQuery : { sparql : \"select * where {?a ?b ?c}\"}\n\t}\n})\n\nlet subscription = app.simpleQuery({})\nsubscription.on(\"notification\",console.log)\n```\n\n#### JSAP object example:\n```javascript\njsap_example = {\n\thost: \"mml.arces.unibo.it\",\n\toauth: {\n\t\tenable : false,\n\t\tregister: \"https://localhost:8443/oauth/register\",\n\t\ttokenRequest: \"https://localhost:8443/oauth/token\"\n\t},\n\tsparql11protocol: {\n\t\tprotocol: \"http\",\n\t\tport: 8000,\n\t\tquery: {\n\t\t\tpath: \"/query\",\n\t\t\tmethod: \"POST\",\n\t\t\tformat: \"JSON\"\n\t\t},\n\t\tupdate: {\n\t\t\tpath: \"/update\",\n\t\t\tmethod: \"POST\",\n\t\t\tformat: \"JSON\"\n\t\t}\n\t},\n\tsparql11seprotocol: {\n\t\tprotocol: \"ws\",\n\t\tavailableProtocols: {\n\t\t\tws: {\n\t\t\t\tport: 9000,\n\t\t\t\tpath: \"/subscribe\"\n\t\t\t},\n\t\t\twss: {\n\t\t\t\tport: 9443,\n\t\t\t\tpath: \"/secure/subscribe\"\n\t\t\t}\n\t\t}\n\t},\n\tnamespaces: {\n\t\texp: \"http://www.w3.org/example#\",\n\t},\n\tupdates: {\n\t\tsimpleUpdate: {\n\t\t\tsparql: \"INSERT DATA { exp:hello exp:from 'js' }\"\n\t\t},\n\t\tupdateArgs: {\n\t\t\tsparql: \"INSERT DATA {?sub ?pred ?obj}\",\n\t\t\tforcedBindings: {\n\t\t\t\tsub: {\n\t\t\t\t\ttype: \"uri\",\n\t\t\t\t\tvalue: \"exp:hello\"\n\t\t\t\t},\n\t\t\t\tpred: {\n\t\t\t\t\ttype: \"uri\",\n\t\t\t\t\tvalue: \"exp:from\"\n\t\t\t\t},\n\t\t\t\tobj: {\n\t\t\t\t\ttype: \"literal\",\n\t\t\t\t\tvalue: \"js\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t},\n\t queries : {\n\t\t simpleQuery : {\n\t\t\t sparql : \"select * where{?a ?b ?c}\"\n\t\t},\n\t\t queryArgs : {\n\t\t\t sparql : \"select * where{?a ?b ?c}\",\n\t\t\t forcedBindings : {\n\t\t\t\t a : {\n\t\t\t\t\t type : \"uri\",\n\t\t\t\t\t value : \"exp:subj\"\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n```\n#### Subscriber\n```javascript\nsubscriber = new JsapApi(jsap_example)\nlet sub = subscriber.simpleQuery({})\nsub.on(\"notification\",console.log)\n\n```\n#### Publisher\n```javascript\npublisher = new JsapApi(jsap_example)\npublisher.simpleUpdate().then(res=\u003e{console.log(\"Update response: \" + res)})\n```\n#### Forced bindings\nThe JSAP api support query bindings to easly inject data in query templates. Here is an example to use a producer with code specifed bindings:\n```javascript\napp = new JsapApi(jsap_example)\ndata = {\n  sub : \"exp:person1\",\n  pred: \"exp:hasName\",\n  obj : \"Max\"\n}\napp.updateArgs(data).then(res=\u003e{console.log(\"Update response: \" + res)})\n```\nThe SPARQL update issued to the broker will be:\n```sparql\nPREFIX exp:\u003chttp://www.w3.org/example#\u003e\nINSERT DATA {exp:person1 exp:hasName 'Max'}\n```\n**Note** with JSAP you can specify default arguments and their types\n\n## Contributing\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\nPlease make sure to update tests as appropriate.\n\n**Note**: run tests with `npm run tests` and if succefull `npm run integration-test`. Additionally, integration tests needs a default SEPA instance \nrunning on your local machine. Refer to [SEPA github page](https://github.com/arces-wot/SEPA) for information about the installation and configuration. \n\n## License\n[LGPL](https://choosealicense.com/licenses/lgpl-3.0/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaimee%2Fsepa-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvaimee%2Fsepa-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaimee%2Fsepa-js/lists"}