{"id":28213509,"url":"https://github.com/solidlabresearch/hive-thought-rewriter","last_synced_at":"2025-06-15T00:33:04.351Z","repository":{"id":293083854,"uuid":"982093905","full_name":"SolidLabResearch/hive-thought-rewriter","owner":"SolidLabResearch","description":"Rewriting different RSP-QL queries (thoughts) by combining or decomposing in a Hive. ","archived":false,"fork":false,"pushed_at":"2025-06-05T12:45:50.000Z","size":209,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-11T17:56:45.183Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SolidLabResearch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-12T11:14:37.000Z","updated_at":"2025-06-05T12:45:51.000Z","dependencies_parsed_at":"2025-06-11T17:44:14.900Z","dependency_job_id":"d9ce3d84-5624-422e-bbcd-c4c996e8d94a","html_url":"https://github.com/SolidLabResearch/hive-thought-rewriter","commit_stats":null,"previous_names":["solidlabresearch/hive-thought-rewriter"],"tags_count":2,"template":false,"template_full_name":"argahsuknesib/TS-Template","purl":"pkg:github/SolidLabResearch/hive-thought-rewriter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SolidLabResearch%2Fhive-thought-rewriter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SolidLabResearch%2Fhive-thought-rewriter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SolidLabResearch%2Fhive-thought-rewriter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SolidLabResearch%2Fhive-thought-rewriter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SolidLabResearch","download_url":"https://codeload.github.com/SolidLabResearch/hive-thought-rewriter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SolidLabResearch%2Fhive-thought-rewriter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259905308,"owners_count":22929915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2025-05-17T20:10:46.342Z","updated_at":"2025-06-15T00:33:04.320Z","avatar_url":"https://github.com/SolidLabResearch.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hive Thought Rewriter\n\nThe library rewrites different RSP-QL queries to either combine or decompose. \n\n## Usage\n\n### Installation\n\n```shell\nnpm install hive-thought-rewriter\n```\n\n## Rewriting Queries by Combining\n\nDifferent queries in RSP-QL [[1](#footnotes-1)] query format can be specified and combined together to create a single RSP-QL query.\n\n\n```ts\nimport {QueryCombiner} from \"hive-thought-rewriter\";\n\nconst combiner = new QueryCombiner();\n\ncombiner.addQuery(query1);\ncombiner.addQuery(query2);\n\nconst combined = combiner.combine();\n/**\n * This will return the RSPQL query and it's different components \n * in a object with type Parsed Query\n * \n * To get the query in string format\n */\n\nconst combined_query_string = combiner.ParsedToString(combined);\n```\n\n\n## Rewriting Queries by Decomposing\n\nThis is currently not possible and is a work in progress. \n\n## Rewriting the Queries by changing the Window Parameters\n\n```ts\n\nimport {RewriteChunkQuery} from \"hive-thought-rewriter\";\n\n// Define the new window parameters for the query i.e slide is 10 and width is 20\n\nconst chunkRewriter = new RewriteChunkQuery(10, 20);\n\nconst originalQuery = `PREFIX ex: \u003chttp://example.org/\u003e\n            REGISTER RStream \u003coutput\u003e AS\n            SELECT (AVG(?age) AS ?averageAge)\n            FROM NAMED WINDOW ex:w ON STREAM ex:stream [RANGE 10 STEP 5]\n            WHERE {\n                WINDOW ex:w {\n                    ?person a ex:Employee.\n                    ?person ex:hasAge ?age.\n                }\n            }`;\n\nconst rewrittenQuery = chunkRewriter.rewrite(originalQuery);\n/**\n * This will return the RSPQL query with the new window parameters as a string\n */\n```\n\n## License\n\nThis code is copyrighted by [Ghent University - imec](https://www.ugent.be/ea/idlab/en) and released under the [MIT Licence](./LICENCE) \n\n\n### Footnotes\n[1]: \u003ca href=\"https://www.igi-global.com/article/rsp-ql-semantics/129761\"\u003eRSP-QL Semantics: A Unifying Query Model to Explain Heterogeneity of RDF Stream Processing Systems \u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolidlabresearch%2Fhive-thought-rewriter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsolidlabresearch%2Fhive-thought-rewriter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsolidlabresearch%2Fhive-thought-rewriter/lists"}