{"id":13791242,"url":"https://github.com/rosette-api/sqlite-kb-connector","last_synced_at":"2025-08-18T19:36:09.425Z","repository":{"id":146184586,"uuid":"285345563","full_name":"rosette-api/sqlite-kb-connector","owner":"rosette-api","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-24T20:38:46.000Z","size":8369,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-01-11T20:46:13.470Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","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/rosette-api.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":"2020-08-05T16:26:03.000Z","updated_at":"2023-01-24T20:38:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"7cf8fa10-e912-4d4e-8c67-c229f2d63c7a","html_url":"https://github.com/rosette-api/sqlite-kb-connector","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosette-api%2Fsqlite-kb-connector","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosette-api%2Fsqlite-kb-connector/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosette-api%2Fsqlite-kb-connector/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rosette-api%2Fsqlite-kb-connector/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rosette-api","download_url":"https://codeload.github.com/rosette-api/sqlite-kb-connector/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241329412,"owners_count":19944984,"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":"2024-08-03T22:00:57.770Z","updated_at":"2025-03-01T06:44:52.482Z","avatar_url":"https://github.com/rosette-api.png","language":"Java","readme":"# Rosette Entity Extractor Sqlite Knowledge Base Connector\n\nThe Rosette Entity Extractor supports linking to custom knowledge bases instead of or in addition to the\ndefault Wikidata knowledge base shipped with the product.\nThis package includes a sample knowledge base with an entry of `Boston`.\nThe knowledge base is stored as a sqlite database.\n\nRequirements:\n- Rosette Enterprise 1.24.0\n- Rosette Enterprise license for Entity Extraction and English\n- [OPTIONAL] If you start Rosette Server via docker-compose, Docker must be installed and running on your machine\n\n## Build\n\nDefine some variables\n\n```\nexport ROSAPI_HOME=/path-to-rosette-install/server directory\nexport KB_CONNECTOR_HOME=/path-to-this-directory\n```\nTo build the Sqlite Knowledge Base Connector, run\n\n```\ncd $KB_CONNECTOR_HOME\nmvn -Drosapi.home=$ROSAPI_HOME -P extract-flinx-api-jar\nmvn -Drosapi.home=$ROSAPI_HOME -P build-kb-connector\n```\n\nThis will build the `sqlite-kb-connector-1.0.jar` in the target directory.\n\n## Integrate with Rosette Server\n\nCopy `sqlite-kb-connector-1.0.jar` and `kb/` into Rosette Server\n```\ncp target/sqlite-kb-connector-1.0.jar $ROSAPI_HOME/launcher/bundles\ncp -r kb $ROSAPI_HOME\n```\n\nEdit `$ROSAPI_HOME/launcher/config/rosapi/rex-factory-config.yaml` and add the following lines\n\n```\n#The option to link mentions to knowledge base entities with disambiguation model.\n#Enabling this option also enables calculateConfidence.\nlinkEntities: true\n\n#Custom list of Knowledge Bases for the linker, in order of priority.\nkbs:\n    - ../kb/MyKnowledgeBase1\n    - ${rex-root}/data/flinx/data/kb/basis\n```\n\n## Run\n\nStart Rosette Server\n```\n$ROSAPI_HOME/bin/launch.sh console\n```\nCall the /entities endpoint with linking to the custom knowledge base\n```\ncurl -s --request POST 'http://localhost:8181/rest/v1/entities' \\\n--header 'Content-Type: application/json' \\\n--header 'Accept: application/json' \\\n--data '{\"content\":\"Boston is beautiful.\", \"options\": {\"linkEntities\": true}}' \\\n| jq .\n``` \n\nThe output is\n```\n{\n    \"entities\": [\n        {\n            \"type\": \"LOCATION\",\n            \"mention\": \"Boston\",\n            \"normalized\": \"Boston\",\n            \"count\": 1,\n            \"mentionOffsets\": [\n                {\n                    \"startOffset\": 0,\n                    \"endOffset\": 6\n                }\n            ],\n            \"entityId\": \"E2\",\n            \"linkingConfidence\": 0.74136907\n        }\n    ]\n}\n```\nNotice that the entityId for `Boston` is E2, which comes from the knowledge base.\n\nWhen linkEntities option is false\n```\ncurl -s --request POST 'http://localhost:8181/rest/v1/entities' \\\n--header 'Content-Type: application/json' \\\n--header 'Accept: application/json' \\\n--data '{\"content\":\"Boston is beautiful.\", \"options\": {\"linkEntities\": false}}' \\\n| jq .\n``` \nthe entityId is T0, which is a temporary id.\n```\n{\n    \"entities\": [\n        {\n            \"type\": \"LOCATION\",\n            \"mention\": \"Boston\",\n            \"normalized\": \"Boston\",\n            \"count\": 1,\n            \"mentionOffsets\": [\n                {\n                    \"startOffset\": 0,\n                    \"endOffset\": 6\n                }\n            ],\n            \"entityId\": \"T0\"\n        }\n    ]\n}\n```\n\n## The Docker way\n\n1. Edit the `docker-compose.yaml` file, adding the following files to the volumes section.\n```\nvolumes:\n  - rosette-roots-vol:/rosette/server/roots:ro\n  - ${ROSAPI_LICENSE_PATH}:/rosette/server/launcher/config/rosapi/rosette-license.xml:ro\n  - ${KB_CONNECTOR_HOME}/config/rex-factory-config.yaml:/rosette/server/launcher/config/rosapi/rex-factory-config.yaml\n  - ${KB_CONNECTOR_HOME}/kb:/customKBs\n  - ${KB_CONNECTOR_HOME}/target/sqlite-kb-connector-1.0.jar:/rosette/server/launcher/bundles/sqlite-kb-connector-1.0.jar:ro\n```\n\n2. Start the Rosette Server Docker container\n```\nROSAPI_LICENSE_PATH=\u003cpath-to-license\u003e/rosette-license.xml docker-compose up\n```\n\nCall the /entities endpoint with linking to the custom knowledge base\nThe result should be the same as show above.\n","funding_links":[],"categories":["Sample code"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frosette-api%2Fsqlite-kb-connector","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frosette-api%2Fsqlite-kb-connector","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frosette-api%2Fsqlite-kb-connector/lists"}