{"id":45181206,"url":"https://github.com/rla/node-swipl","last_synced_at":"2026-03-05T08:01:17.509Z","repository":{"id":46195154,"uuid":"88290890","full_name":"rla/node-swipl","owner":"rla","description":"A node.js interface to the SWI-Prolog library.","archived":false,"fork":true,"pushed_at":"2021-11-08T08:39:12.000Z","size":67,"stargazers_count":30,"open_issues_count":3,"forks_count":4,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-11-27T10:52:49.724Z","etag":null,"topics":["nodejs","prolog","swi-prolog"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"jansegre/node-swipl","license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rla.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-14T18:03:23.000Z","updated_at":"2024-01-10T13:59:40.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/rla/node-swipl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/rla/node-swipl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rla%2Fnode-swipl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rla%2Fnode-swipl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rla%2Fnode-swipl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rla%2Fnode-swipl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rla","download_url":"https://codeload.github.com/rla/node-swipl/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rla%2Fnode-swipl/sbom","scorecard":{"id":778454,"data":{"date":"2025-08-11","repo":{"name":"github.com/rla/node-swipl","commit":"3420a23d4ac9f37d1ac8d306a34d356980411e05"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Code-Review","score":0,"reason":"Found 1/28 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: GNU Lesser General Public License v3.0: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T04:16:01.800Z","repository_id":46195154,"created_at":"2025-08-23T04:16:01.801Z","updated_at":"2025-08-23T04:16:01.801Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30115662,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T03:40:26.266Z","status":"ssl_error","status_checked_at":"2026-03-05T03:39:15.902Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["nodejs","prolog","swi-prolog"],"created_at":"2026-02-20T10:00:30.840Z","updated_at":"2026-03-05T08:01:17.490Z","avatar_url":"https://github.com/rla.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# node-swipl\n\nA Node.js interface to the SWI-Prolog.\n\n[![Build Status](https://travis-ci.org/rla/node-swipl.svg?branch=master)](https://travis-ci.org/rla/node-swipl)\n\n## Installation:\n\nYou need to have SWI-Prolog installed and `swipl` binary available in\n`PATH` and compiler installed. See \"Platform support\" for operating system\nsupport. The library requires Node.js version 7+ and SWI-Prolog 8+.\n\n```\nnpm install swipl\n```\n\nAlso see \"Known issues\" for currently unsolved problems.\n\n## Usage\n\nCalling a predicate and returning bindings with\nthe first solution:\n\n```js\nconst swipl = require('swipl');\nconst ret = swipl.call('member(X, [1,2,3,4])');\nif (ret) {\n    console.log(`Variable X value is: ${ret.X}`);\n} else {\n    console.log('Call failed.');\n}\n```\n\nOutputs:\n\n```\nVariable X value is: 1\n```\n\nCalling a predicate and returning all solutions:\n\n```js\nconst swipl = require('swipl');\nconst query = new swipl.Query('member(X, [1,2,3,4])');\nlet ret = null;\nwhile (ret = query.next()) {\n    console.log(`Variable X value is: ${ret.X}`);\n}\n```\n\nOutputs:\n\n```\nVariable X value is: 1\nVariable X value is: 2\nVariable X value is: 3\nVariable X value is: 4\n```\n\nThere can be only one query open at a time.\n\n### Create modules and specify context\n\nUse module operator `:` to call code in different\nmodules. The default call assumes the `user` module.\n\n```js\nswipl.call('assert(mymodule:test(1))');\nconsole.log(swipl.call('mymodule:test(X)'));\n```\n\n### Consult external files\n\nLoad code from external files. You might have\nto set the working directory if you want to use relative paths.\n\n```js\nswipl.call('working_directory(_, prolog)');\nswipl.call('consult(mycode)');\n```\n\n### Constructing safe queries\n\nQueries with data requiring proper escaping can be constructed\nby using helper functions from swipl.term.\n\nExample:\n\n```js\nconst swipl = require('./');\nconst { list, compound, variable, serialize } = swipl.term;\n\nconst escaped = serialize(\n    compound('member', [\n        variable('X'),\n        list([1, 2, 3, 4])]));\n\nconsole.log(swipl.call(escaped));\n```\n\nBlobs and dicts are not supported.\n\n### Output term representation\n\nProlog terms in variable bindings are converted into\nJavaScript objects under the following rules:\n\n * Integers are converted to numbers.\n * Floats are converted to numbers.\n * Atoms and strings are converted to strings.\n * Empty list is converted to string `[]`.\n * List head tail pair is converted to object `{ head, tail }` where\n   `head` and `tail` are converted terms.\n * Compound term is converted to object `{ name, args }` where\n   `name` is the compound functor name and `args` is the array\n   of converted argument terms.\n * Blobs and dicts are not supported and will throw an error.\n\n### Error handling\n\nSyntax errors in queries are thrown. Error messages\nare read from the prolog. The current query is automatically\nclosed.\n\nInvalid query example: `member(X, [1,2,3,4]` (missing closing paren):\n\n```js\nswipl.call('member(X, [1,2,3,4]');\n```\n\nThrows error with message:\n\n```\nError: Error during query execution. Syntax error:\nOperator expected\nmember(X, 1,2,3,4\n** here **\n```\n\nKnown errors are thrown with the error message.\n\n```js\nswipl.call('error:must_be(ground, _)');\n```\n\nThrows error with message:\n\n```\nError: Error during query execution. Arguments are\nnot sufficiently instantiated.\n```\n\nCustom errors without a message are thrown with JavaScript\nerror containing the error term:\n\n```js\nswipl.call('throw(error(test))');\n```\n\nThrows error with message:\n\n```\nError: Error during query execution. Unknown message: error(test).\n```\n\n### Disable autoinitialization\n\nThe embedded SWI-Prolog engine is automatically initialized\nwhen creating the first query. This behavior can be disabled\nby calling `swipl.autoInitialise(false)` before any query is\nexecuted. The engine can be initialized later manually with\nthe `swipl.initialise()` function.\n\n## Platform support\n\nThe bindings are tested on various Linux distributions, on Windows,\nand on MacOS. SWI-Prolog command `swipl` must be available in `PATH`\non all of these operating systems.\n\n### Windows\n\nMicrosoft build tools must be installed:\n\n```\nnpm install --global --production windows-build-tools\n```\n\nSWI-Prolog command `swipl` must be available in `PATH`.\n\n### MacOS\n\nSWI-Prolog must be installed or compiled through Macports. This is\ndescribed here \u003chttp://www.swi-prolog.org/build/macos.html\u003e. The setup was\ntested on MacOS Sierra by installing dependencies from ports and compiling\nwith prefix `/usr/local` (adjust `build.templ`).\n\n## Known issues\n\n * Unicode data cannot be exchanged.\n * Exporting PL_BLOB terms is not handled.\n * Exporting PL_DICT terms is not supported. It is not supported at all by SWI-Prolog\n   foreign interface.\n * Installed files cannot be copied around on *nix. The linker has `libswipl` location\n   specified absolutely in the binding object file. The location of `SWI_HOME_DIR` is\n   determined install-time and written into the file `plbase.conf`.\n * Attempt to use native SWI packages leads to symbol lookup errors\n   like `readutil.so: undefined symbol: PL_new_atom`.\n * Custom initialization parameters are not yet implemented.\n\n## Development\n\nA list of helpful resources:\n\n * SWI-Prolog Foreign Interface documentation: \u003chttp://www.swi-prolog.org/pldoc/man?section=foreign\u003e\n * Node.js native addons: \u003chttps://nodejs.org/api/addons.html\u003e\n * PySWIP sources: \u003chttps://code.google.com/archive/p/pyswip/\u003e\n\n## Alternatives\n\n * [Pengines package][pengines-package].\n * Package [swipl-stdio][swipl-stdio].\n * Run SWI as HTTP server and create a JSON API.\n\n[pengines-package]:https://www.npmjs.com/package/pengines\n[swipl-stdio]:https://github.com/rla/node-swipl-stdio\n\n## Authors\n\nPlease see the AUTHORS file.\n\n## License\n\nLicensed under LGPL 3.0. A copy is available in [the LICENSE.txt file](LICENSE.txt).\nFile `lib/serialize_string.js` is ported from the [pengines][pengines] project and is licensed\nunder BSD (see the file header).\n\n[pengines]:https://github.com/SWI-Prolog/pengines\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frla%2Fnode-swipl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frla%2Fnode-swipl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frla%2Fnode-swipl/lists"}